Thursday, October 1, 2015

Arduino Project to control Traffic signals

Circuit Diagram:




Apparatus required:


1x red led

1x yellow led

1x green led

1x Arduino board

1x Breadboard

Connecting wires


Connection:



Connect Arduino and bread board with connecting wires
connect pin 10= red led anode
pin 9= yellow led anode
pin 8=green led anode




visit   http://www.instructables.com/id/Traffic-signal-control/


Program:




//Traffic light in arduino UNO R3
void setup() {
  pinMode(10, OUTPUT);
  pinMode(9, OUTPUT);
  pinMode(8, OUTPUT);
}
void loop() {
  digitalWrite(10, HIGH); // turn the red light on
  delay(10000); // wait 5 seconds
  
  digitalWrite(9, HIGH); // turn on yellow
  delay(2000); // wait 2 seconds
  
  digitalWrite(8, HIGH); // turn green on
  digitalWrite(10, LOW); // turn red off
  digitalWrite(9, LOW); // turn yellow off
  delay(10000); // wait ledDelay milliseconds
  
  digitalWrite(9, HIGH); // turn yellow on
  digitalWrite(8, LOW); // turn green off
  delay(2000); // wait 2 seconds
  digitalWrite(9, LOW); // turn yellow off
  // now our loop repeats
}
                                     



For details follow us and ask in  Contact Form. You will receive response in 24 hours






0 comments:

Post a Comment