Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to create a task with priority 2.
FreeRTOS
xTaskCreate(taskFunction, "Task1", 1000, NULL, [1], NULL);
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 0 as priority which is the idle priority.
Confusing stack size with priority.
✗ Incorrect
The fifth parameter sets the task priority. Here, priority 2 is correct.
2fill in blank
mediumComplete the code to set the priority of an existing task to 3.
FreeRTOS
vTaskPrioritySet([1], 3);
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Passing NULL which changes the priority of the current task.
Passing the task function name instead of the handle.
✗ Incorrect
The first parameter is the handle of the task whose priority you want to change.
3fill in blank
hardFix the error in setting the task priority to 4 for a task handle named myTaskHandle.
FreeRTOS
vTaskPrioritySet(myTaskHandle, [1]); Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using a string instead of an integer for priority.
Using undefined constants.
✗ Incorrect
The priority must be an integer value, not a string or undefined variable.
4fill in blank
hardFill both blanks to create a task with priority 5 and stack size 2000.
FreeRTOS
xTaskCreate(taskFunction, "Task2", [1], NULL, [2], NULL);
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Swapping stack size and priority parameters.
Using too small stack size for the task.
✗ Incorrect
The third parameter is stack size, and the fifth is priority.
5fill in blank
hardFill all three blanks to create a task with name "Logger", priority 3, and stack size 1500.
FreeRTOS
xTaskCreate([1], [2], [3], NULL, 3, NULL);
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using stack size as a string.
Confusing task name and function name.
Using wrong priority value.
✗ Incorrect
The first argument is the task function name, second is the task name string, third is stack size.