![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
very simple Freertos hello world
Dependencies: mbed freertos_test FreeRTOS
main.cpp
- Committer:
- chalikias
- Date:
- 2015-09-13
- Revision:
- 0:7f7fa5e631ec
- Child:
- 1:be76e6fdff84
File content as of revision 0:7f7fa5e631ec:
// http://www.radekdostal.com/content/freertos-610-minimal-example #include "mbed.h" #include "FreeRTOS.h" #include "task.h" DigitalOut led1(LED1); DigitalOut led2(LED2); DigitalOut led3(LED3); DigitalOut led4(LED4); void Task1 (void* pvParameters) { (void) pvParameters; // Just to stop compiler warnings. for (;;) { vTaskDelay(500); led1 = !led1; printf("Task A\n"); vTaskDelay(500); } } void Task2 (void* pvParameters) { (void) pvParameters; // Just to stop compiler warnings. for (;;) { led2= !led2; printf("Task B\n"); vTaskDelay(5000); } } int main (void) { xTaskCreate( Task1, ( signed char * ) "TaskA", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY, ( xTaskHandle * ) NULL ); xTaskCreate( Task2, ( signed char * ) "TaskB", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY, ( xTaskHandle * ) NULL ); vTaskStartScheduler(); //should never get here printf("ERORR: vTaskStartScheduler returned!"); for (;;); }