#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include <stdio.h>
// #define DELAY_TO_BE_USED 15
void vPrintTask1(void *params);
void vPrintTask2(void *params);
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
Serial.println("Hello, ESP32!");
xTaskCreate(vPrintTask1, "Task 1", 50000, NULL, 1, NULL);
xTaskCreate(vPrintTask2, "Task 2", 50000, NULL, 1, NULL);
vTaskStartScheduler();
}
void loop() {
// put your main code here, to run repeatedly:
// delay(10); // this speeds up the simulation
// return 0 ;
}
void vPrintTask1(void *params)
{
while(1)
{
printf("Task 1 before calling taskYIELD\n");
taskYIELD();
printf("Task 1 after calling taskYIELD\n");
}
}
void vPrintTask2(void *params)
{
while(1)
{
printf("Task 2 is running now !\n");
taskYIELD();
}
}