Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Program: Write an Arduino sketch to simulate the traffic lights at 19^th and Boston. The lights should cycle green rightarrow yellow rightarrow red, with a
Program: Write an Arduino sketch to simulate the traffic lights at 19^th and Boston. The lights should cycle green rightarrow yellow rightarrow red, with a shorter cycle time for Boston traffic and a longer cycle time for 19^th St. There should be a short period when lights are red for both directions to avoid accidents. You could use realistic cycle-lengths, but you'll get tired of waiting for a full day's worth of cycles. So you might use a 5-second green and 1-second yellow for Boston and an 15-second green and 2-second yellow for 19^th St. with a 1 second period of red-both-ways. When a pedestrian is present, the green-light cycle length should be increased by 2 seconds for a pedestrian crossing Boston, and 4 seconds for a pedestrian crossing 19^th St. When an emergency vehicle is detected, switch to solid red for both directions, until 2 seconds after the emergency vehicle is gone. From 10 PM to 7 AM, the lights should go to flashing red (Boston) and yellow (19^th St.). Again, to avoid needing 24 hours to test your simulation, you may use 1 full cycle per hour for Red/Yellow/Green, and 2 flashes for Yellow/Red flashing. I don't know what happens with the lights if a pedestrian presses the button between 10 PM & 7 AM...you can choose whether to give the pedestrian a green light, or just leave it blinking. Your program should use Serial print(...) to print a log of what is happening on your computer screen. This will help the grader verify your program does what it should. The log should show what state the light is in, what the time delay is, and whether there are pedestrians waiting or an emergency vehicle coming
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started