This programme simulates behavior of traffic lights by use of state machine.
Possible states:
- <State 1> Cars: green, pedestrians: red
- <State 2> Cars: yellow, pedestrians: red
- <State 3> Cars: red, pedestrians: green
Possible transitions:
- <State 1> ➡️ <State 2> after 10 seconds
- <State 2> ➡️ <State 3> after 20 seconds or after pushing button*
- <State 3> ➡️ <State 1> after 2 seconds
pushing button is simulated by not empty input from keyboard