micro:bit мигалка
Dependencies: mbed BLE_API nRF51822
Программа для исполнительного устройства на micro:bit (nRF51822), включение\выключение светодиода по команде с управляющего устройства на nRF51822.
Diff: main.cpp
- Revision:
- 2:ffd28faae17e
- Parent:
- 1:222379aed289
- Child:
- 3:69ccae6ab80a
--- a/main.cpp Tue Oct 24 18:24:18 2017 +0000 +++ b/main.cpp Sat Dec 14 07:03:18 2019 +0000 @@ -18,10 +18,11 @@ #include "ble/BLE.h" #include "LEDService.h" -DigitalOut alivenessLED(p16, 0); -DigitalOut actuatedLED(p6, 0); +DigitalOut col0(P0_7, 0); +DigitalOut alivenessLED(P0_13, 0); +DigitalOut actuatedLED(P0_14, 1); -Serial pc(p5, p4); +//Serial pc(p5, p4); const static char DEVICE_NAME[] = "LED"; static const uint16_t uuid16_list[] = {LEDService::LED_SERVICE_UUID}; @@ -37,7 +38,7 @@ { if(!onConnection){ alivenessLED = !alivenessLED; /* Do blinky on LED1 to indicate system aliveness. */ - actuatedLED = 1; +// actuatedLED = 1; } } @@ -108,8 +109,8 @@ int main(void) { - pc.baud(115200); - pc.printf("Initialization starts... \n"); +// pc.baud(115200); +// pc.printf("Initialization starts... \n"); ticker.attach(periodicCallback, ts); /* Blink LED every second */ actuatedLED = 1; @@ -119,7 +120,7 @@ /* SpinWait for initialization to complete. This is necessary because the * BLE object is used in the main loop below. */ //while (ble.hasInitialized() == false) { /* spin loop */ } - pc.printf("Initialization finished \n"); +// pc.printf("Initialization finished \n"); while (true) { ble.waitForEvent();