Microduino Traffic Light Simulation
PurposeThe course will show you how to use Microduino to simulate a traffic light. Equipment
SchematicAs the pictures show: Red light—Stop Yellow—Wait to turn color Green—Go The driving light—white light together with blinking red light reminds pedestrians to stop. Just like this: ProgramDebuggingStep 1: Build the circuit according to the schematic, as follows:
2.When the red light goes off and the yellow light goes on in traffic light 1, it means "Ready to go". At the same time, the yellow light in traffic light 2 goes on, meaning "Ready to stop". 3.When green light in traffic light 1 goes on, it means "Go". The red light goes on and driving lamp blinks in traffic light 2, it means "Stop". 4.When the yellow light in traffic light goes on, it means "Read to stop". Meantime, the red light goes off and yellow light goes on in traffic light 2, it means "Ready to go". The variable "duration" in the code defines duration time of each circumstance: int duration[] = { 8000,3000,10000,3000}; // duration of each situation From the crossroads picture above, you can see two traffic lights in this example are in different direction.
ResultTwo traffic lights will simulate traffic lights in two directions at the crossroads as well as how they work in real life. Video |