Traffic Light Simulator

by kai___ in Circuits > Arduino

567 Views, 0 Favorites, 0 Comments

Traffic Light Simulator

image.jpg

This Arduino project combines buttons and lights to make a nice little traffic light simulator in a Cross way. Have fun and observe! I have made some changes, including button coding and differences in the traffic lights. This projects includes 2 sets of traffic lights to create a realistic Cross way.

Materials:

55903594-8ADE-472B-A745-C092D4B5CD90.jpeg

Here are the materials needed:

- your Arduino board

- a breadboard

- six led lights (2 greens, 2 red, 2 yellow)

- a button of your choice

- 6 resistors (220ohm)

- 10 or more wires

Attach the First Led Light

1C1B2F01-587B-4105-AFE8-7EB393D12CAC.jpeg

Attach your wire to pin 8 on the Arduino board, and the other side to the positive leg on your led. On the negative leg, attach a resistor. Attach the other side of the resistor to Ground (negative) on the breadboard.

Attach Second and Third Lights

261CD906-8136-4429-82AA-7D16C295A72F.jpeg

Connect the yellow and green lights the same way as step one

- yellow can be connected to pin 9

- green can be connected to pin 10

Connect Second Traffic Light

0EC96B1F-B80C-4E2A-A485-A56DE2A607D8.jpeg

Connect the second set of traffic light in the Cross way for a realistic simulation. Steps are the same as previous.

- red can be connected to pin 11

- yellow can be pin 12

- and green can be connected to pin 13

Button Connection

C60234E7-A579-4C75-87FA-23A18A2C42A4.jpeg

Add a button onto the breadboard. Connect a resistor onto the bottom left corner, attaching it onto the Ground (negative) on the other end. Attach a wire on the bottom right corner of the button, and the other side to the power rail (positive) of the breadboard. Lastly, connect a wire to the top part of the button, and the other side to pin 2.

Power It Up

0343B514-148C-4CE9-8ADC-3D1D29C762B3.jpeg

Connect a wire from 5v to the Ground on the breadboard (negative)

And a wire from Gnd to the power rail on the breadboard (positive)

Coding