A cute tiny piece of code implementing an IoT NAND device, demonstrating how to setup and advertise a cute GATT (NAND) service. The code has been tested on a Nordic nRF51822-DK.
Dependencies: BLE_API mbed nRF51822
Fork of BLE_HeartRate_IDB0XA1 by
Diff: main.cpp
- Revision:
- 25:339931243be4
- Parent:
- 23:2e73c391bb12
--- a/main.cpp Sun Jan 08 23:16:12 2017 +0000 +++ b/main.cpp Sat May 19 14:09:24 2018 +0000 @@ -26,21 +26,19 @@ advertise(o); // resume advertising on disconnection } - void cbSetup(O&o) // setup calback (after BLE init) + int main(void) { + O o; // Oh-ohh - our Blob (BLuetooth OBject) + init(o); // init BLE base layer, always do first + onDisconnect(o,cbDisconnect); // setup disconnection callback onWritten(o,cbWritten); // setup data written callback device(o,"NAND Gate"); // setup device name - name(o,"N04#1.0 NAND"); // add name to device + name(o,"N06#2.0 NAND"); // add name to device enroll(o,tiny); // enroll (register) TINY service advertise(o,"C:ng",100); // start advertising @ 100 msec interval - } - int main(void) - { - O o; // Oh-ohh - our Blob (BLuetooth OBject) - init(o,cbSetup); // init BLE base layer, always do first for(;;) sleep(o); // low power waiting for BLE events } \ No newline at end of file