Red Light, Green Light, 123

by naschein in Circuits > LEDs

310 Views, 0 Favorites, 0 Comments

Red Light, Green Light, 123

IMG_4047.jpg

In this LED arduino, it will teach you how to make your very own traffic light!! Make sure to follow the code and arduino set up! Good luck and have fun!!

Code

IMG_4045.jpg

This is the code for the traffic light.

In the void setup you activate your outputs by writing a "pinMode"

In your loop, you start your line of code with "digitalWrite" which is used to tell an object to go on or off

Then you write your pin number, in this example, either 11, 12, or 13

Then write HIGH, which turns on the light

Then you "delay", so the light stays on for a period of time

You write LOW, to turn off the light

Then do the same steps for the next color (pin number)

Arduino Set Up

IMG_4046.jpg

1. Place a wire into ground and connect it to the red positive side of your bread board

2. Place three more wires out of each pinMode into the breadboard

3. Place a green, yellow, and red light with the short leg in ground and long leg next to the wire