mbed official
/
rtos_basic
Basic example showing the Thread API
Embed:
(wiki syntax)
Show/hide line numbers
main.cpp
00001 #include "mbed.h" 00002 #include "rtos.h" 00003 00004 DigitalOut led1(LED1); 00005 DigitalOut led2(LED2); 00006 Thread thread; 00007 00008 void led2_thread() { 00009 while (true) { 00010 led2 = !led2; 00011 Thread::wait(1000); 00012 } 00013 } 00014 00015 int main() { 00016 thread.start(led2_thread); 00017 00018 while (true) { 00019 led1 = !led1; 00020 Thread::wait(500); 00021 } 00022 }
Generated on Tue Jul 12 2022 11:27:26 by 1.7.2