0
0
FreeRTOSprogramming~10 mins

Multiple tasks running concurrently 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 create a FreeRTOS task named "Task1".

FreeRTOS
xTaskCreate([1], "Task1", 1000, NULL, 1, NULL);
Drag options to blanks, or click blank then click option'
AvTaskFunction
BvTaskStartScheduler
CvTaskDelete
DvTaskDelay
Attempts:
3 left
💡 Hint
Common Mistakes
Using scheduler or delay functions instead of the task function.
Passing NULL instead of a function.
2fill in blank
medium

Complete the code to start the FreeRTOS scheduler.

FreeRTOS
int main() {
    // Create tasks here
    [1]();
    for(;;);
}
Drag options to blanks, or click blank then click option'
AvTaskDelete
BvTaskStartScheduler
CxTaskCreate
DvTaskDelay
Attempts:
3 left
💡 Hint
Common Mistakes
Calling task creation functions instead of starting the scheduler.
Forgetting to start the scheduler.
3fill in blank
hard

Fix the error in the task delay call to delay for 1000 milliseconds.

FreeRTOS
void vTaskFunction(void *pvParameters) {
    for(;;) {
        // Do work
        vTaskDelay([1]);
    }
}
Drag options to blanks, or click blank then click option'
ApdMS_TO_TICKS(1000)
B1000
C1000 / portTICK_PERIOD_MS
D1000 * portTICK_PERIOD_MS
Attempts:
3 left
💡 Hint
Common Mistakes
Passing raw milliseconds directly to vTaskDelay.
Multiplying instead of converting properly.
4fill in blank
hard

Fill both blanks to create two tasks with different priorities.

FreeRTOS
xTaskCreate(Task1Function, "Task1", 1000, NULL, [1], NULL);
xTaskCreate(Task2Function, "Task2", 1000, NULL, [2], NULL);
Drag options to blanks, or click blank then click option'
A2
B1
C3
D0
Attempts:
3 left
💡 Hint
Common Mistakes
Using the same priority for both tasks.
Assigning lower priority to the task that should run first.
5fill in blank
hard

Fill all three blanks to create a task that deletes itself after running once.

FreeRTOS
void vOneShotTask(void *pvParameters) {
    // Task code here
    [1](pdMS_TO_TICKS(1000));
    [2](NULL);
    for(;;) {
        [3](NULL);
    }
}
Drag options to blanks, or click blank then click option'
AvTaskDelay
BvTaskDelete
CvTaskSuspend
DvTaskStartScheduler
Attempts:
3 left
💡 Hint
Common Mistakes
Calling delete without NULL parameter.
Not delaying before deleting.
Using start scheduler inside a task.