Traffic Light Simulator with Override to trigger a buzzer

The "traffic light" exercise is a very good contender for a state machine approach.
There are plenty of examples

since its all non-blocking code you can add in the test for an input and compare with the
"timeElapsed" each time around the loop.

1 Like