working
Dependencies: mbed BLE_API nRF51822 VL53L0X
Diff: main.cpp
- Revision:
- 1:94152e7d8b5c
- Parent:
- 0:cd5b6733aeb1
- Child:
- 2:e84c13abc479
diff -r cd5b6733aeb1 -r 94152e7d8b5c main.cpp --- a/main.cpp Fri Feb 13 21:02:25 2015 +0000 +++ b/main.cpp Sat Feb 14 06:49:01 2015 +0000 @@ -1,10 +1,31 @@ #include "mbed.h" #include "BLEDevice.h" +#include "CustomService.h" + + +// BLE object +BLEDevice ble; + +// LED object +DigitalOut led(LED1); + +const static char DEVICE_NAME[] = "MyDeviceName"; // change this +static const uint16_t uuid16_list[] = {0xFF}; //Custom UUID, FF is reserved for development + +// Restart advertising when phone app disconnects +void disconnectionCallback(Gap::Handle_t handle, Gap::DisconnectionReason_t reason) +{ + ble.startAdvertising(); // restart advertising +} int main(void) { - printf("This is an example program..."); - while(1){} + led = 0; // turn LED off + ble.init(); // initialize BLE + + // TODO: impliment the rest of triggering for LED based on Write of characteristic. + // TODO: impliment a read characteristic that sends text back to app + // take a look at http://developer.mbed.org/teams/Bluetooth-Low-Energy/code/BLE_GroveColourSensor/file/000c8f8c7f03/main.cpp for inspiration. } \ No newline at end of file