0
0
FreeRTOSprogramming~10 mins

Health monitoring and heartbeat 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 heartbeat task that toggles an LED.

FreeRTOS
void HeartbeatTask(void *pvParameters) {
    for(;;) {
        ToggleLED();
        vTaskDelay([1]);
    }
}
Drag options to blanks, or click blank then click option'
A100 / portTICK_PERIOD_MS
B10 / portTICK_PERIOD_MS
C1000 / portTICK_PERIOD_MS
D5000 / portTICK_PERIOD_MS
Attempts:
3 left
💡 Hint
Common Mistakes
Using too long or too short delay causing no visible heartbeat.
2fill in blank
medium

Complete the code to initialize the watchdog timer with a timeout.

FreeRTOS
void InitWatchdog() {
    Watchdog_Config config = {
        .timeout = [1]
    };
    Watchdog_Init(&config);
}
Drag options to blanks, or click blank then click option'
A5000
B20000
C1000
D10000
Attempts:
3 left
💡 Hint
Common Mistakes
Setting timeout too short causing frequent resets.
3fill in blank
hard

Fix the error in the watchdog refresh function to prevent system reset.

FreeRTOS
void RefreshWatchdog() {
    [1]();
}
Drag options to blanks, or click blank then click option'
AWatchdog_Feed
BWatchdog_Reset
CWatchdog_Refresh
DWatchdog_Kick
Attempts:
3 left
💡 Hint
Common Mistakes
Using a non-existent function name causing compile errors.
4fill in blank
hard

Fill both blanks to create a health check task that signals system status.

FreeRTOS
void HealthCheckTask(void *pvParameters) {
    for(;;) {
        if(SystemIsHealthy()) {
            SignalStatus([1]);
        } else {
            SignalStatus([2]);
        }
        vTaskDelay(1000 / portTICK_PERIOD_MS);
    }
}
Drag options to blanks, or click blank then click option'
ALED_GREEN
BLED_RED
CLED_BLUE
DLED_YELLOW
Attempts:
3 left
💡 Hint
Common Mistakes
Swapping LED colors causing confusing signals.
5fill in blank
hard

Fill all three blanks to create a dictionary mapping task names to their heartbeat intervals.

FreeRTOS
const TaskHeartbeatConfig taskHeartbeats = {
    [1]: [2],
    [3]: 500
};
Drag options to blanks, or click blank then click option'
A"SensorTask"
B1000
C"CommTask"
D2000
Attempts:
3 left
💡 Hint
Common Mistakes
Mixing keys and values or using wrong data types.