
Blinky program for SDP-K1.
Revision 4:25001877a575, committed 2019-11-05
- Comitter:
- malavikasaji
- Date:
- Tue Nov 05 21:22:37 2019 +0000
- Parent:
- 3:fe562166cbfe
- Child:
- 5:ec269055afca
- Commit message:
- Updating to the latest mbed_os_example_blinky program. ; Removed awakeSignal. ; Removed deprecated wait_ms().
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- 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); } }