Seesaw
FreeRTOS Two Tasks Sharing a Beat Exercise
Task
A seesaw in a science museum rocks by itself. One FreeRTOS task lifts its end and logs UP, the other lowers its end and logs DOWN. A technician reads the tick count on each line to check both ends move together. The tick is FreeRTOS's clock. Ticks come every millisecond.
Write up_task and down_task, two tasks at priority 1 named UP and DOWN, made in that order. Each says its name with say(), then waits 20 ms, for as long as the board runs: 0 UP, 0 DOWN, 20 UP, 20 DOWN, 40 UP and on, one per line The FreeRTOS calls for this are xTaskCreate, vTaskStartScheduler and vTaskDelay; the Reference tab shows each one.
Circuit
Pass condition
Each line shows the tick it was said on. UP then DOWN come on the same tick, on ticks 0, 20, 40 and on.
Notes
Leave the given code as is. FreeRTOS V11.1.0. The millisecond tick counts from the moment the scheduler starts. On this board, tasks of the same priority first run in the order they were made.