Class Bertl added
Dependents: BertlDrive_V2 BertlDrive_V2
Diff: ur_Bertl.cpp
- Revision:
- 7:e7f74f072564
- Parent:
- 6:df6830254e8b
- Child:
- 12:cedc088eaf05
--- a/ur_Bertl.cpp Fri Apr 10 09:31:54 2015 +0000 +++ b/ur_Bertl.cpp Mon Apr 13 15:28:10 2015 +0000 @@ -1,11 +1,12 @@ /*********************************** -name: ur_Bertl.cpp Version: 2.0 +name: ur_Bertl.cpp Version: 2.1 author: PE HTL BULME email: pe@bulme.at WIKI: https://developer.mbed.org/teams/BERTL_CHEL_18/code/ur_Bertl/ description: Implementation portion of class ur_Bertl The Robot - boolean commands added for if/else, while, ... + boolean commands added for if/else, while, ... + int ReturnButtonPressed() added which returns the int value of button pressed ***********************************/ #include "mbed.h" #include "config.h" @@ -282,6 +283,22 @@ return wert; } +int ur_Bertl::ReturnButtonPressed() +{ + char cmd[3]; // array for I2C + int16_t btns; + + cmd[0] = 0x06; + cmd[1] = 0x00; + i2c.write(addr, cmd, 2); + + cmd[0]=0x01; + i2c.write(addr, cmd, 1); + i2c.read(addr|1, cmd, 1); + btns = cmd[0]; + DEBUG_PRINT("Button: %d", btns); + return btns; +} // Protected methodes int ur_Bertl::bottomIsBlack()