0
0
FreeRTOSprogramming~10 mins

vTaskDelay() for periodic tasks in FreeRTOS - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to delay the task for 100 ticks.

FreeRTOS
vTaskDelay([1]);
Drag options to blanks, or click blank then click option'
A100
B1000
C10
D1
Attempts:
3 left
💡 Hint
Common Mistakes
Using milliseconds instead of ticks.
Forgetting that the argument is in ticks, not time units.
2fill in blank
medium

Complete the code to create a periodic task that delays for 200 ticks.

FreeRTOS
for (;;) {
    // Task code here
    vTaskDelay([1]);
}
Drag options to blanks, or click blank then click option'
A50
B20
C200
D500
Attempts:
3 left
💡 Hint
Common Mistakes
Using too short or too long delay values.
Not placing the delay inside the infinite loop.
3fill in blank
hard

Fix the error in the code to correctly delay the task for 500 ticks.

FreeRTOS
vTaskDelay([1]); // Delay for 500 ticks
Drag options to blanks, or click blank then click option'
A5
B500
C50
D5000
Attempts:
3 left
💡 Hint
Common Mistakes
Confusing milliseconds with ticks.
Using a value ten times too large or too small.
4fill in blank
hard

Fill both blanks to create a periodic task that delays for 100 ticks and prints "Tick" each cycle.

FreeRTOS
for (;;) {
    printf([1]);
    vTaskDelay([2]);
}
Drag options to blanks, or click blank then click option'
A"Tick\n"
B100
C"Hello"
D10
Attempts:
3 left
💡 Hint
Common Mistakes
Printing the wrong string.
Using the wrong delay value.
5fill in blank
hard

Fill all three blanks to create a periodic task that prints the count, delays for 50 ticks, and increments the count.

FreeRTOS
int count = 0;
for (;;) {
    printf([1], [2]);
    vTaskDelay([3]);
    count++;
}
Drag options to blanks, or click blank then click option'
A"Count: %d\n"
Bcount
C50
D"Value: %d\n"
Attempts:
3 left
💡 Hint
Common Mistakes
Using the wrong format string.
Printing a wrong variable.
Using incorrect delay value.