mbed official
/
rtos_signals
Basic example showing the Signals API
Embed:
(wiki syntax)
Show/hide line numbers
main.cpp
00001 #include "mbed.h" 00002 #include "rtos.h" 00003 00004 DigitalOut led(LED1); 00005 00006 void led_thread() { 00007 while (true) { 00008 // Signal flags that are reported as event are automatically cleared. 00009 Thread::signal_wait(0x1); 00010 led = !led; 00011 } 00012 } 00013 00014 int main (void) { 00015 Thread thread; 00016 00017 thread.start(callback(led_thread)); 00018 00019 while (true) { 00020 Thread::wait(1000); 00021 thread.signal_set(0x1); 00022 } 00023 }
Generated on Tue Jul 12 2022 11:27:37 by 1.7.2