Question: (Two-way Traffic light)- Develop a python that simulates a two-way (North-South and West-East) traffic lights. Three LEDs (green, yellow, red) needs to be turned on
(Two-way Traffic light)- Develop a python that simulates a two-way (North-South and West-East) traffic lights. Three LEDs (green, yellow, red) needs to be turned on in a sequence for both ways. The sequence is as follow:
When the light is green in North-South side, the light in the West-East is red.
When the light turns yellow in North-South side, the light in the West-East side is still red.
When the light in North-South turns red, the light in West-East becomes green. This process needs to be continued.
Make the duration of the green light to be 5 seconds, yellow light 1 seconds and the red light 5 seconds.
Use 330 resistors to protect the LEDs from burning out.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
