![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
BLE_Driver Example
Dependencies: BLE_API BLE_Driver mbed nRF51822
Diff: mainbletest.cpp
- Revision:
- 0:882170680817
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mainbletest.cpp Mon Aug 22 01:04:43 2016 +0000 @@ -0,0 +1,34 @@ +#include "mbed.h" +#include "BLE_Driver.h" + +DigitalOut LIVE_LED(LED1, 1); +DigitalOut CONECT_LED(LED2, 1); +DigitalOut TEST_LED(LED3, 1); +DigitalIn TEST_BUTTON(p17,PullUp); + +void callbackBLE(int event) { + switch (event){ + case 1: CONECT_LED = 0; break; + case 2: CONECT_LED = 1; break; + default: break; + } + } + +void periodicCallback(void){ + LIVE_LED =! LIVE_LED; + uint8_t a; + a= getBLE(); + if (a=='G') + TEST_LED = !TEST_LED; + } + +int main(void){ + Ticker Flasher; + Flasher.attach(periodicCallback, 1); + iniBLE("Sigfried"); + while(1){ + if (TEST_BUTTON == 0) + putBLE("Hola\n\r"); + } + } +