gg
Fork of Workshop-1-Example-3 by
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 00007 void led2_thread(void const *args) { 00008 while (true) { 00009 led2 = !led2; 00010 Thread::wait(1000); 00011 } 00012 } 00013 00014 int main() { 00015 //Create a thread to execute the function led2_thread 00016 Thread thread(led2_thread); 00017 //led2_thread is executing concurrently with main at this point 00018 00019 while (true) { 00020 led1 = !led1; 00021 Thread::wait(500); 00022 } 00023 }
Generated on Mon Aug 8 2022 04:41:33 by
1.7.2
