Simple Arduino Traffic Lights
Have you ever made a city out of Legos? I know i have built many of them but they all missed something... Traffic lights!
So i decided to make my very own traffic light setup from my arduino board.

Step 1: You will need:

Simple Arduino Traffic Lights
Simple Arduino Traffic Lights
Simple Arduino Traffic Lights
You will need:

An arduino board
Red, Green and amber LED's
Three 220 Ohm Resistors

Optional:

Wire
and an Protoshield

Step 2: Get the components

Simple Arduino Traffic Lights
I assume you already have an adruino board, and maybe also a Protoshield.

You'll need the LED's and resistors

the 220 Ohm resistors are color coded so: Red, Red, Brown

Step 3: Hook up to the board

Simple Arduino Traffic Lights
Since this is a really simple project we only need 3 digital pins and ground.

Put the LED's in the breadboard/protoboard and use the resistors to connect them to the digital pins,

Green to pin 8
Yellow to pin 9
and Red to pin 10

then connect all the negative pins of the LED's together and to ground.

Step 4: Upload the code!

Simple Arduino Traffic Lights
Again, since this is a really simple project the code is also simple,
just copy it from below and upload it to your board via USB.

int greenled = 8; //Led's and pins
int yellowled = 9;
int redled = 10;

void setup()
{
pinMode(greenled, OUTPUT); //Pinmodes of the leds
pinMode(yellowled, OUTPUT);
pinMode(redled, OUTPUT);
}

void loop()
{
digitalWrite(greenled, HIGH); //Green on for 5 seconds
delay(5000);
digitalWrite(greenled, LOW); //Green off, yellow on for 2 seconds
digitalWrite(yellowled, HIGH);
delay(2000);
digitalWrite(yellowled, LOW); //yellow off, red on for 5 seconds
digitalWrite(redled, HIGH);
delay(5000);
digitalWrite(yellowled, HIGH); //Yellow and red on for 2 seconds
delay(2000);
digitalWrite(redled, LOW); //Red and Yellow off
digitalWrite(yellowled, LOW);
}

Step 5: Watch your traffic being controlled :)

Now you can see your very own traffic lights, control traffic.
the lights change according to European standards.

 
 

Tag cloud

make build easy simple arduino making homemade solar laser printed portable cheap mini building custom cardboard wooden create super lego turn paracord chocolate your paper light intel