Modify the BlinkThreadCallback example so you run two threads that blink different LEDs once per second by waiting for each other
main.cpp
- Committer:
- vicara
- Date:
- 2018-11-11
- Revision:
- 0:11ca69d691b7
- Child:
- 1:30693312f670
File content as of revision 0:11ca69d691b7:
#include "mbed.h" Thread thread; DigitalOut led1(LED1); DigitalOut led2(LED2); // Blink function toggles the led in a long running loop void blink(DigitalOut *led) { *led = !*led; wait(1); } int main() { while(true){ thread.start(callback(blink, &led1)); thread.join(); thread.start(callback(blink, &led2)); } }