#include <Arduino_FreeRTOS.h>
TaskHandle_t xHandle1;
TaskHandle_t xHandle2;
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
xTaskCreate(Task1, "Task no. 1!", 100, NULL, 1, &xHandle1);
xTaskCreate(Task2, "Task no. 2!", 100, NULL, 1, &xHandle2);
}
void loop() {
// put your main code here, to run repeatedly:
}
static void Task1(void* pvParameters) {
while (1) {
Serial.println(F("Task no. 1!"));
vTaskDelay(10 / portTICK_PERIOD_MS);
}
}
//Task 2
static void Task2(void* pvParameters) {
int count = 0;
while (1) {
Serial.println(F("Task no. 2!"));
count++;
if (count == 10) {
Serial.println(F("Change priority"));
//vTaskPrioritySet(xHandle1, 0);
vTaskPrioritySet(xHandle1, 2);
}
vTaskDelay(10 / portTICK_PERIOD_MS);
}
}