← All exercises

Delayed Shutdown

medium

Holds the run output high for a cooldown period after a stop command is received.

What it teaches

Off-delay with a real-world framing: equipment runs, Stop fires, the output stays on for the cooldown, then drops. The twist: Start during cooldown cancels it and returns to running — that needs a small state machine (Stopped, Running, Cooldown), not just a bare off-delay timer.

Inputs and outputs

TagTypeDefaultDescription
In_StartBOOLStarts the equipment (1 = start)
In_StopBOOLStops the equipment (1 = stop)
Cfg_CooldownMsDINT5000Cooldown period in milliseconds
Out_RunBOOLEquipment run command

Required behavior