Traffic Light

Description

The light stays on green for 20 seconds, switches to yellow for 3 seconds, then to red for 6 seconds. If the pedestrian button is pressed when the light is green, the light will skip to a yellow then red light. While the light is red, a buzzer (not in video) will beep once per second for 4 seconds then 5 times per second for the last 2 seconds before it switches back to green.

Python Code
Java Script Traffic Light

The java script traffic light was made using p5js. It follows the same light sequence as the python version. Click the traffic light to switch to pedestrian crossing.