Malavika S
/
SDP_K1_blinky_program
Blinky program for SDP-K1.
Diff: main.cpp
- Revision:
- 4:25001877a575
- Parent:
- 1:3d0efe79e629
diff -r fe562166cbfe -r 25001877a575 main.cpp --- a/main.cpp Mon Jul 08 16:19:41 2019 +0000 +++ b/main.cpp Tue Nov 05 21:22:37 2019 +0000 @@ -37,22 +37,28 @@ */ #include "mbed.h" +#include "platform/mbed_thread.h" -Serial pc(USBTX, USBRX); // tx, rx -DigitalOut awakeSignal(LED4); + +// Blinking rate in milliseconds +#define SLEEP_TIME 500 + + +// Initialise the digital pin LED1 as an output DigitalOut led1(LED1); +// Initialise the serial object with TX and RX pins +Serial pc(USBTX, USBRX); -#define SLEEP_TIME 500 // (msec) + // main() runs in its own thread in the OS int main() { - awakeSignal = 1; pc.printf("Hello World!"); while (true) { - // Blink LED and wait 0.5 seconds + // Blink LED and wait 500 ms led1 = !led1; - wait_ms(SLEEP_TIME); + thread_sleep_for(SLEEP_TIME); } }