Skip to content
State machine (FSM) templates

Pedestrian Crossing (State Machine)

Signal states for a pelican crossing.

Template previewState machine (FSM)
Pedestrian crossing4 states · 4 transitions · 2 eventsbutton_pressedtimertimertimerCarsGreenCarsAmberCarsRedWalkOnAll 4 states are reachable and every transition names states that exist.INFONo state is marked `final`, so this machine never terminates. That is ordinary for a reactive controller and a smell for a workflow.OKAll 4 states are reachable from `CarsGreen`.OKAll 4 transitions name states that exist, so every arrow in the figure is drawn.

Make it your own.

title "Pedestrian crossing"
state CarsGreen
state CarsAmber
state CarsRed
state WalkOn
initial CarsGreen
transition CarsGreen -> CarsAmber on "button_pressed"
transition CarsAmber -> CarsRed on "timer"
transition CarsRed -> WalkOn on "timer"
transition WalkOn -> CarsGreen on "timer"