Marco Zecchini
/
Example_RTOS
Rtos API example
Embed:
(wiki syntax)
Show/hide line numbers
main.cpp
00001 #include "mbed.h" 00002 #include "cmsis_os.h" 00003 00004 #if defined(MBED_RTOS_SINGLE_THREAD) 00005 #error [NOT_SUPPORTED] test not supported 00006 #endif 00007 00008 DigitalOut led1(LED1); 00009 DigitalOut led2(LED2); 00010 00011 void led2_thread(void const *argument) { 00012 while (true) { 00013 led2 = !led2; 00014 osDelay(1000); 00015 } 00016 } 00017 osThreadDef(led2_thread, osPriorityNormal, DEFAULT_STACK_SIZE); 00018 00019 int main() { 00020 osThreadCreate(osThread(led2_thread), NULL); 00021 00022 while (true) { 00023 led1 = !led1; 00024 osDelay(500); 00025 } 00026 }
Generated on Sun Jul 17 2022 08:25:26 by 1.7.2