Diagramium
🚦 Narrated diagram

Traffic light with pedestrian crossing

Red, green, amber — plus the button that actually does something. A narrated state machine everyone has met.

6 steps1 min readNarrated with a studio voice
Traffic light with pedestrian crossingtimer: 2stimer: 1stimer: 20stimer: 3sbutton pressedwalk phase endsThe pseudostate a machine starts fromA state — optionally with entry / exit / do behaviorReddo / cars stoppedA state — optionally with entry / exit / do behaviorRed + Amberdo / get readyA state — optionally with entry / exit / do behaviorGreendo / cars flowingA state — optionally with entry / exit / do behaviorAmberdo / prepare to stopA state — optionally with entry / exit / do behaviorPedestrian WALKdo / green man lit, cars held
Traffic light with pedestrian crossing — the complete diagram. Press Present to watch it build itself.
Step 1 of 6

A traffic light is the state machine you meet every day: it is always in exactly one state, and it only moves along fixed transitions.

Step 2 of 6

Red

Red. Cars stopped. The machine will happily stay here forever until a timer — or a pedestrian — says otherwise.

Step 3 of 6

Red + Amber

Red plus amber together is the get-ready state. It exists purely so drivers can prepare — a state whose whole job is politeness.

Step 4 of 6

Green

Green, and traffic flows. Notice the machine has no memory of how it got here — a state is a complete description of now.

Step 5 of 6

Amber

Amber means the decision has already been made: stopping is coming. Three seconds to wind down.

Step 6 of 6

Pedestrian WALK

And here is the interesting one. Press the button at the crossing and the machine takes a different transition entirely — the walk state holds every car while the green man lights up.

Watch it explain itself

Every step above is narrated aloud. Play it, or open it in the editor and make it yours — no account needed.