Daljeet12
Member level 4
I am trying to understand what happens if we change priority in code in given link https://www.digikey.com/en/maker/pr...t-2-freertos/b3f84c9c9455439ca2dcb8ccfce9dec5
Here I start to think
Task 1 run because of high priority
Task 1 block for 500ms
Task 2 run because Task 1 is blocked
Task 2 block for 323 ms
Now stuck there I am looking help to figureout how both task execute over time
C:
// task 1: blink an LED at one rate, Hight priority
void toggleLED_1(void *parameter) {
while(1) {
digitalWrite(led_pin, HIGH);
vTaskDelay(rate_1 / portTICK_PERIOD_MS); // blocking for 500ms
digitalWrite(led_pin, LOW);
vTaskDelay(rate_1 / portTICK_PERIOD_MS); // blocking for 500ms
}
}
// task 2: blink an LED at another rate, low priority
void toggleLED_2(void *parameter) {
while(1) {
digitalWrite(led_pin, HIGH);
vTaskDelay(rate_2 / portTICK_PERIOD_MS); //blocking for 323ms
digitalWrite(led_pin, LOW);
vTaskDelay(rate_2 / portTICK_PERIOD_MS); //blocking for 323ms
}
}
Task 1 run because of high priority
Task 1 block for 500ms
Task 2 run because Task 1 is blocked
Task 2 block for 323 ms
Now stuck there I am looking help to figureout how both task execute over time