First Shift
First FreeRTOS Task Exercise
Task
At a factory gate, the night shift starts when the doors open. The gate's controller prints OPEN once when it powers up. Then it logs every car that drives in all night, so the guard can check arrivals in the morning.
Print OPEN once, then CAR n for each car, counting n from 1, for as long as the board runs: OPEN, CAR 1, CAR 2, CAR 3 and on, one per line Write gate_task, a FreeRTOS task at priority 1 that prints CAR n each time wait_car() returns, and the rest of main, which prints OPEN and gets the task running. The FreeRTOS calls for this are xTaskCreate and vTaskStartScheduler; the Reference tab shows each one.
Circuit
Pass condition
OPEN prints, then one CAR line per car, in order. CAR 1 prints within 2 ms of the first car reaching PA0.
Notes
The car sensor drives PA0 high for 5 ms as each car passes, while your program runs. Leave the given code as is. FreeRTOS V11.1.0. A task is a function FreeRTOS runs on its own. Priority 1 is a task's urgency. A bigger number is more urgent. FreeRTOS keeps time in ticks of one millisecond.