Question
I NEED A CODE FOR THIS QUESTION PLEASE An automated traffic light system, which follows the UK standard traffic light sequence (Red Red and Amber
I NEED A CODE FOR THIS QUESTION PLEASE
An automated traffic light system, which follows the UK standard traffic light sequence (Red Red and Amber Green Amber Red), is being used to control flow of traffic along a road. There is a pedestrian crossing at this traffic light. The pedestrian crossing uses an image recognition sensor (S1) to count the number of people present, before changing the light sequence to allow the pedestrians to cross. There is a red LED and green LED on the pedestrian crossing, instructing pedestrians whether it is safe to cross. There is also a sensor which counts the number of cars present (S2). The count is checked every 5 seconds. If more people are waiting to cross the road (sensor S1) than cars have been counted (S2) then the lights will stop traffic and the crossing will allow 20 seconds for pedestrians to cross. The maximum time pedestrians will have to wait after the first person is detected 60 seconds, independent of the number of people waiting to cross. Each of the two sensors is simulated using a 4-bit digital input to the microcontroller, the value of the inputs representing the number of cars or pedestrians counted. There is also a fault sensor (S3), which checks the pedestrian crossing and car sensors and, if a fault is detected, then the red pedestrian crossing light and amber traffic light should both flash to warn drivers and pedestrians of an issue with the crossing. You will design this system using KL25Z as the microcontroller to control the above operation. Write a C program that allows a KL25Z to read the values from all sensors and to control the status of the traffic lights and pedestrian crossing. Initially, the traffic light is on green, and the pedestrian crossing is on red. The map of the inputs and outputs is: - Use eight D pins for S1 and S2 inputs (4 each) - Use an additional D pin for fault sensor S3 (1 bit) - Use the onboard LED to represent the pedestrian crossing (red and green) - Use three additional LEDs (with current-limiting resistors) attached to outputs on the board to represent the traffic lights - There should be no condition where both the traffic and the pedestrians can move, as this would be a safety issue for both parties
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