valnaut
Published © GPL3+

Traffic Lights Using Arduino!!

Missing the traffic jam? Well Just make this and roleplay into a traffic jam.

BeginnerProtip11,666
Traffic Lights Using Arduino!!

Things used in this project

Hardware components

Arduino UNO
Arduino UNO
×1
Breadboard (generic)
Breadboard (generic)
×1
5 mm LED: Red
5 mm LED: Red
×1
5 mm LED: Yellow
5 mm LED: Yellow
×1
5 mm LED: Green
5 mm LED: Green
×1
Resistor 330 ohm
Resistor 330 ohm
×3
Jumper wires (generic)
Jumper wires (generic)
×1
9V battery (generic)
9V battery (generic)
×1
9V Battery Clip
9V Battery Clip
×1

Software apps and online services

Arduino IDE
Arduino IDE

Story

Read more

Schematics

BreadBoard_Traffic_Lights

I have used a 220 ohms resistor in schematic but I recommended using a 330 ohms resistor. Also White Leds have been used in place of yellow and green leds, Wiring color should help identify which one where

BreadBoard_Traffic_Lights

I have used a 220 ohms resistor in schematic but I recommended using a 330 ohms resistor. Also White Leds have been used in place of yellow and green leds, Wiring color should help identify which one where

BreadBoard_Traffic_Lights

I have used a 220 ohms resistor in schematic but I recommended using a 330 ohms resistor. Also White Leds have been used in place of yellow and green leds, Wiring color should help identify which one where

Code

BreadBoard_TrafficLights_v2

Arduino
int redLed = 2; // setting the value of redLed as 2.
int blueLed = 3; // setting the value of blueLed as 3.
int greenLed = 4;// setting the value of greenLed as 4.

void setup() {
  // put your setup code here, to run once:
pinMode (redLed,OUTPUT);// Defined redLed as output.
pinMode (blueLed,OUTPUT);// Defined blueLed as output.
pinMode (greenLed,OUTPUT);// Defined greenLed as output.
}

void loop() {
  // put your main code here, to run repeatedly:
digitalWrite (redLed,HIGH);// Sending a signal to Pin redLed to Light Up.
delay (3000);// Giving a Gap of 3000 Milliseconds, 1 second =  1000 milliseconds.
digitalWrite (redLed,LOW);
digitalWrite (blueLed,HIGH);
delay(1000);
digitalWrite(blueLed,LOW);
digitalWrite(greenLed,HIGH);
delay(3000);
digitalWrite(greenLed,LOW);
}

Credits

valnaut
2 projects • 1 follower
Contact

Comments

Please log in or sign up to comment.