Thijs Sillen / mbed-rtos-stm32f411-nucleo-blink-led

Fork of mbed-rtos by mbed official

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 #include "mbed.h"
00002 #include "cmsis_os.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         osDelay(1000);
00011     }
00012 }
00013 osThreadDef(led2_thread, osPriorityNormal, DEFAULT_STACK_SIZE);
00014  
00015 int main() {
00016     osThreadCreate(osThread(led2_thread), NULL);
00017     
00018     while (true) {
00019         led1 = !led1;
00020         osDelay(500);
00021     }
00022 }