![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
BlinkThreadCallback2LED
Embed:
(wiki syntax)
Show/hide line numbers
main.cpp
00001 #include "mbed.h" 00002 00003 DigitalOut led1(LED1); 00004 DigitalOut led2(LED2); 00005 00006 // Blink function toggles the led in a long running loop 00007 void blink(DigitalOut *led) { 00008 *led = !*led; 00009 wait(1); 00010 *led = !*led; 00011 } 00012 int main() { 00013 while(1){ 00014 00015 Thread thread1; 00016 Thread thread2; 00017 00018 thread1.start(callback(blink, &led1)); 00019 thread1.join(); 00020 thread2.start(callback(blink, &led2)); 00021 thread2.join(); 00022 } 00023 }
Generated on Tue Jul 19 2022 18:27:30 by
![doxygen](doxygen.png)