Bird
0
0

Examine this heartbeat task code:

medium📝 Troubleshoot Q6 of 15
FreeRTOS - Design Patterns for RTOS
Examine this heartbeat task code:
void HeartbeatTask(void *pvParameters) {
  while(1) {
    printf("Heartbeat\n");
    vTaskDelay(1000);
  }
}

What is the issue with this implementation?
Awhile(1) loops are not allowed in FreeRTOS tasks
Bprintf cannot be used inside FreeRTOS tasks
CvTaskDelay argument should be in ticks, not milliseconds
DMissing task notification to unblock the task
Step-by-Step Solution
Solution:
  1. Step 1: Check vTaskDelay usage

    vTaskDelay expects ticks, not milliseconds.
  2. Step 2: Identify correct usage

    Use pdMS_TO_TICKS(1000) to convert ms to ticks.
  3. Final Answer:

    vTaskDelay argument should be in ticks, not milliseconds -> Option C
  4. Quick Check:

    Always convert ms to ticks for vTaskDelay [OK]
Quick Trick: Convert ms to ticks with pdMS_TO_TICKS [OK]
Common Mistakes:
  • Passing milliseconds directly to vTaskDelay
  • Assuming printf is disallowed
  • Thinking infinite loops are forbidden

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More FreeRTOS Quizzes