Rotate the Cube Puck to invoke actions on your smartphone. Built on the Puck IOT platform.
Dependencies: Puck MPU6050 mbed
The Cube Puck is an innovative bluetooth-enabled remote control device. It is a six-sided cube that can be rotated to any of its sides to invoke actions linked to that side. The cube puck is completely customizable and therefore also quite versatile.
A tutorial for the Cube Puck is available on GitHub.
Tutorials and in-depth documentation for the Puck platform is available at the project's GitHub page
Diff: main.cpp
- Revision:
- 4:6a2b306b6b41
- Parent:
- 3:6a7310ea51f7
- Child:
- 6:4f2aaa06ff44
- Child:
- 9:fc59099597cd
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