Select the Traffic Light Simulation

timer Asked: Feb 10th, 2016

Question description

question 2 and 3

Exercise #2 -- Traffic Control using 6 Lights

Modify your program so that the 3 lights which represent the other traffic direction are also controlled. It is tempting to use six timers for this task, but the job can be done with just four, and you'll end up with a much cleaner program as a bonus.

Red = O:2/00 Green = O:2/02 Amber = O:2/01
Green = O:2/06 Amber = O:2/05 Red = O:2/04
8 Sec. 4 Sec. 8 Sec. 4 Sec.

<-------------------------------- Time in Seconds ------------------------------>

Still getting the odd Crash? Well it's pretty obvious that these drivers aren't paying much attention to Amber Lights! No need for any more wiring however. You can solve this problem, but it's going take a little more programming.

Exercise #3 -- Traffic Light With Delayed Green

Modify your program so that there is a 1 second period when both directions will have their RED lights illuminated. Note that there are actually 2 such overlaps that need to be accounted for. The timing diagram below shows the six discrete timing intervals required to accomplish the desired sequence of operation, and with proper cascading you should be able to come up with an easy to follow solution using just 6 timers.

Red = O:2/00 Green = O:2/02 Amber = O:2/01 R
Green = O:2/06 Amber = O:2/05 Red = O:2/04
8 sec. 4 sec. 1s 8 sec. 4 sec. 1s

<-------------------------------- Time in Seconds ------------------------------>

If a one second delay is not enough to get these drivers under control then just go ahead and jack the delay up to two!

Tutor Answer

(Top Tutor) Studypool Tutor
School: New York University
Studypool has helped 1,244,100 students
flag Report DMCA
Similar Questions
Hot Questions
Related Tags

Brown University

1271 Tutors

California Institute of Technology

2131 Tutors

Carnegie Mellon University

982 Tutors

Columbia University

1256 Tutors

Dartmouth University

2113 Tutors

Emory University

2279 Tutors

Harvard University

599 Tutors

Massachusetts Institute of Technology

2319 Tutors

New York University

1645 Tutors

Notre Dam University

1911 Tutors

Oklahoma University

2122 Tutors

Pennsylvania State University

932 Tutors

Princeton University

1211 Tutors

Stanford University

983 Tutors

University of California

1282 Tutors

Oxford University

123 Tutors

Yale University

2325 Tutors