Traffic Intersection Simulation
For my Finite State Machine, I made a traffic intersection simulation. Basically it manages traffic flow at the point of intersection. I used green LED as a traffic light to signal “GO” for cars, and pressure sensor to detect traffic flow at the point of intersection.
State 1: Sensor detects cars on a lane
State 2: Other sensor check cars on the crossing lane
State 3: Gives signal
State 4: Back to State 1
*Both sensors check cars simultaneously, lane with green light has priority. Light off represents red light; blinking light represents yellow; solid green represents green. 1 second is allowed before yellow light on the crossing lane to let car pass intersection before light changes entirely.
Arduino Sketch: traffic_sim