#include <freertos/FreeRTOS.h>
#include <freertos/task.h>
TaskHandle_t myTask1Handle = NULL;
TaskHandle_t myTask2Handle = NULL;
void myTask1 (void *p){
int count = 0;
while (1)
{
Serial.println("Hello world!: %d\r\n", count++);
vTaskDelay(1000 * configTICK_RATE_HZ/1000);
Serial.println("The task2 has a name: %s\r\n", pcTaskGetName(myTask2Handle));
}
}
void myTask2 (void *p){
while(1){
Serial.println("Hello, STM32!");
vTaskDelay(1000 * configTICK_RATE_HZ/1000);
}
}
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
Serial.println("Hello, STM32!");
}
void loop() {
// put your main code here, to run repeatedly:
xTaskCreate(myTask1,"task1",200,(void*) 0,tskIDLE_PRIORITY, &myTask1Handle);
xTaskCreate(myTask2,"task2",200,(void*) 0,tskIDLE_PRIORITY, &myTask2Handle);
vTaskStartScheduler();
delay(10); // this speeds up the simulation
}