![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
gg
Fork of Workshop-1-Example-3 by
Diff: main.cpp
- Revision:
- 0:04fa7fb0681e
diff -r 000000000000 -r 04fa7fb0681e main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Mon Sep 26 16:14:45 2016 +0000 @@ -0,0 +1,23 @@ +#include "mbed.h" +#include "rtos.h" + +DigitalOut led1(LED1); +DigitalOut led2(LED2); + +void led2_thread(void const *args) { + while (true) { + led2 = !led2; + Thread::wait(1000); + } +} + +int main() { + //Create a thread to execute the function led2_thread + Thread thread(led2_thread); + //led2_thread is executing concurrently with main at this point + + while (true) { + led1 = !led1; + Thread::wait(500); + } +} \ No newline at end of file