Beacon demo for the BLE API using the nRF51822 native mode drivers
Dependencies: BLE_API mbed nRF51822 X_NUCLEO_IDB0XA1
Fork of BLE_iBeacon by
Diff: main.cpp
- Revision:
- 9:438f44012039
- Parent:
- 8:d851d92601b7
- Child:
- 10:391c1acf4b9d
--- a/main.cpp Tue May 20 18:05:08 2014 +0100 +++ b/main.cpp Thu May 22 09:54:46 2014 +0100 @@ -19,8 +19,8 @@ nRF51822n nrf; /* BLE radio driver */ -DigitalOut led1(LED1); -DigitalOut led2(LED2); +DigitalOut mainloopLED(LED1); +DigitalOut tickerLED(LED2); Ticker flipper; Serial pc(USBTX,USBRX); @@ -33,9 +33,9 @@ /**************************************************************************/ int main(void) { - /* Setup blinky: led1 is toggled in main, led2 is toggled via Ticker */ - led1 = 1; - led2 = 1; + /* Setup blinky: mainloopLED is toggled in main, tickerLED is toggled via Ticker */ + mainloopLED = 1; + tickerLED = 1; flipper.attach(&tickerCallback, 1.0); /* Initialise the nRF51822 */ @@ -87,19 +87,19 @@ nrf.getGap().setAdvertisingData(advData, scanResponse); nrf.getGap().startAdvertising(advParams); - /* Do blinky on LED1 while we're waiting for BLE events */ + /* Do blinky on mainloopLED while we're waiting for BLE events */ for (;; ) { - led1 = !led1; + mainloopLED = !mainloopLED; wait(1); } } /**************************************************************************/ /*! - @brief Ticker callback to switch led2 state + @brief Ticker callback to switch tickerLED state */ /**************************************************************************/ void tickerCallback(void) { - led2 = !led2; + tickerLED = !tickerLED; }