a hack to use buttons to fake a cube puck
Dependencies: MPU6050 Puck mbed
Fork of cube-puck by
Diff: main.cpp
- Revision:
- 4:6a2b306b6b41
- Parent:
- 3:6a7310ea51f7
- Child:
- 6:fc59099597cd
- Child:
- 7:4f2aaa06ff44
diff -r 6a7310ea51f7 -r 6a2b306b6b41 main.cpp --- a/main.cpp Thu Jul 24 14:28:09 2014 +0000 +++ b/main.cpp Fri Jul 25 08:01:45 2014 +0000 @@ -85,14 +85,13 @@ log_direction(direction); uint8_t directionAsInteger = direction; - puck->updateCharacteristicValue(DIRECTION_UUID, &directionAsInteger, 1); + int length = 1; + puck->updateCharacteristicValue(DIRECTION_UUID, &directionAsInteger, length); } int main() { - Ticker ticker; - ticker.attach(updateCubeDirection, 1); LOG_VERBOSE("MPU6050 test startup:\n"); @@ -105,13 +104,19 @@ LOG_ERROR("MPU not properly initialized!\n"); } + int characteristicValueLength = 1; puck->addCharacteristic( CUBE_SERVICE_UUID, DIRECTION_UUID, - 1, + characteristicValueLength, GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_READ | GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_NOTIFY); puck->init(0xC0BE); + + + Ticker ticker; + ticker.attach(updateCubeDirection, 1); + LOG_INFO("Started listening to orientation changes.\n"); while(puck->drive()); } \ No newline at end of file