working
Dependencies: mbed BLE_API nRF51822 VL53L0X
main.cpp@1:94152e7d8b5c, 2015-02-14 (annotated)
- Committer:
- mbedAustin
- Date:
- Sat Feb 14 06:49:01 2015 +0000
- Revision:
- 1:94152e7d8b5c
- Parent:
- 0:cd5b6733aeb1
- Child:
- 2:e84c13abc479
added a little more skeleton to it, still needs to be fully flushed out, tossed the HeartRate service code into the custom service.h file, added link to Grove Colour Sensor example for inspiration for later
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
mbedAustin | 0:cd5b6733aeb1 | 1 | #include "mbed.h" |
mbedAustin | 0:cd5b6733aeb1 | 2 | #include "BLEDevice.h" |
mbedAustin | 1:94152e7d8b5c | 3 | #include "CustomService.h" |
mbedAustin | 1:94152e7d8b5c | 4 | |
mbedAustin | 1:94152e7d8b5c | 5 | |
mbedAustin | 1:94152e7d8b5c | 6 | // BLE object |
mbedAustin | 1:94152e7d8b5c | 7 | BLEDevice ble; |
mbedAustin | 1:94152e7d8b5c | 8 | |
mbedAustin | 1:94152e7d8b5c | 9 | // LED object |
mbedAustin | 1:94152e7d8b5c | 10 | DigitalOut led(LED1); |
mbedAustin | 1:94152e7d8b5c | 11 | |
mbedAustin | 1:94152e7d8b5c | 12 | const static char DEVICE_NAME[] = "MyDeviceName"; // change this |
mbedAustin | 1:94152e7d8b5c | 13 | static const uint16_t uuid16_list[] = {0xFF}; //Custom UUID, FF is reserved for development |
mbedAustin | 1:94152e7d8b5c | 14 | |
mbedAustin | 1:94152e7d8b5c | 15 | // Restart advertising when phone app disconnects |
mbedAustin | 1:94152e7d8b5c | 16 | void disconnectionCallback(Gap::Handle_t handle, Gap::DisconnectionReason_t reason) |
mbedAustin | 1:94152e7d8b5c | 17 | { |
mbedAustin | 1:94152e7d8b5c | 18 | ble.startAdvertising(); // restart advertising |
mbedAustin | 1:94152e7d8b5c | 19 | } |
mbedAustin | 0:cd5b6733aeb1 | 20 | |
mbedAustin | 0:cd5b6733aeb1 | 21 | |
mbedAustin | 0:cd5b6733aeb1 | 22 | int |
mbedAustin | 0:cd5b6733aeb1 | 23 | main(void) |
mbedAustin | 0:cd5b6733aeb1 | 24 | { |
mbedAustin | 1:94152e7d8b5c | 25 | led = 0; // turn LED off |
mbedAustin | 1:94152e7d8b5c | 26 | ble.init(); // initialize BLE |
mbedAustin | 1:94152e7d8b5c | 27 | |
mbedAustin | 1:94152e7d8b5c | 28 | // TODO: impliment the rest of triggering for LED based on Write of characteristic. |
mbedAustin | 1:94152e7d8b5c | 29 | // TODO: impliment a read characteristic that sends text back to app |
mbedAustin | 1:94152e7d8b5c | 30 | // take a look at http://developer.mbed.org/teams/Bluetooth-Low-Energy/code/BLE_GroveColourSensor/file/000c8f8c7f03/main.cpp for inspiration. |
mbedAustin | 0:cd5b6733aeb1 | 31 | } |