We're at the start of a new Arduino project: an automatic railway crossing.
The system comprises several parts: train detection (optical), blinking lights ('blink' with a twist), a moving beam (servo motor).
We'll look into a way of specifying these kinds of systems as well as a way to translate the specifications into code, with a stepwise approach that does not put too much strain on our grey cells.
Fun with Arduino 17 Railway Crossing, State Transition Diagram, switch()