#include <Arduino_FreeRTOS.h>
TaskHandle_t Task1Handle;
void setup() {
Serial.begin(9600);
xTaskCreate(task1, "print task", 128, NULL, 2, &Task1Handle);
xTaskCreate(task2, "print task", 128, NULL, 2, NULL);
}
void loop() {
//this is an empty code
}
void task1(void *pvParameters){
while(1){
Serial.println("Hello from Task1");
vTaskDelay(1000/portTICK_PERIOD_MS);
}
}
void task2(void *pvParameters){
int x = 0;
while(1){
//if we want to attempt in changing the priority task
Serial.print("Priority of Task 1 = ");
x = uxTaskPriorityGet(Task1Handle); //getting the priority task
vTaskPrioritySet(Task1Handle, 1); //this is what we use to attempt
//changing the task
Serial.println(x);
Serial.print("Priority of Task 1 = ");
x = uxTaskPriorityGet(Task1Handle);
Serial.println(x);
vTaskDelay(1000/portTICK_PERIOD_MS);
}
}