Nathan Yonkee
/
Nucleo_rtos_basic
copy of mbed-rtos example
Embed:
(wiki syntax)
Show/hide line numbers
main.cpp
00001 #include "mbed.h" 00002 #include "rtos.h" 00003 00004 void print_char(char c = '*') 00005 { 00006 printf("%c", c); 00007 fflush(stdout); 00008 } 00009 00010 DigitalOut led1(LED1); 00011 00012 void print_thread(void const *argument) 00013 { 00014 while (true) { 00015 Thread::wait(1000); 00016 print_char(); 00017 } 00018 } 00019 00020 int main() 00021 { 00022 printf("\n\n*** RTOS basic example ***\n"); 00023 Thread thread(print_thread, NULL, osPriorityNormal, DEFAULT_STACK_SIZE); 00024 while (true) { 00025 led1 = !led1; 00026 Thread::wait(500); 00027 } 00028 }
Generated on Thu Jul 14 2022 21:16:05 by 1.7.2