Question: I have all the other code I just need help with the night mode emergency push button code. Modify project 1 to simulate the working

I have all the other code I just need help with the night mode emergency push button code. Modify project 1 to simulate the working of two sets of traffic lights at an intersection as shown below. Here
are the sequence of events:
a. When program starts, all traffic lights will be red for 2 seconds.
b. The green lights for the two left arrows turn on simultaneously.
c. After 6 seconds, the two left arrows will go to amber and then red.
d. After 2 seconds from the left arrows being red to clear the intersection, the E-W and W-E lights will
turn green.
e. After 8 seconds, the W-E and E-W lights will go to amber and then red together.
f. After 2 seconds from all lights to be red to clear the intersection, the N-S and S-N lights will go
green together.
g. After 8 seconds, the N-S and S-N lights will go to amber and then red together.
h. The E-W pedestrian light will be green when the N-S light is green and red otherwise. The N-S
pedestrian light will be green when the E-W light is green, red otherwise.
i. The pattern will repeat again starting at point (a) above.
2. Add a night/emergency pushbutton such that if it is pressed at any moment, the current traffic cycle in
either the E-W (including the arrow) or N-S direction will finish its normal sequence but will not go to the
next direction. Instead, the system will flash red lights for the N-S and yellow lights for the E-W until the
emergency button is pressed again. Pedestrian lights should flash red only. Note that the pushbutton
should be pressed once to activate the emergency mode. No need to hold the pushbutton to activate. If the
emergency button is pressed while ALL lights are red, there is no need to start a new cycle.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!