Friday, 18 January 2019

ARDUINO AS TRAFFIC SIGNAL LIGHT

IN THIS POST HOW TO CREATE A TRAFFIC SIGNAL LIGHT USING ARDUINO MICROCONTROLLER

NEEDS


RED LED 1N
GREEN LED 1N
YELLOW LED 1N
ARDUINO /UNO/NANO/PRO MINI ANY TYPE

TIME DELAY FOR SEQUANCE

FOR 1 MINUTE
                          60SEC*1000=60000= 1MINUTE


CIRCUIT DIAGRAM

 

CODE




// the setup function runs once when you press reset or power the board
void setup() {
  // initialize digital pin LED_BUILTIN as an output.
 
  pinMode(3, OUTPUT);
  pinMode(4, OUTPUT);
}

// the loop function runs over and over again forever
void loop() {
 

  digitalWrite(3, HIGH);   // turn the LED on (HIGH is the voltage level)
  delay(50000);
  ;                      // wait for a second
  digitalWrite(3, LOW);    // turn the LED off by making the voltage LOW
  delay(1);

  digitalWrite(4, HIGH);   // turn the LED on (HIGH is the voltage level)
  delay(60000);
  ;                      // wait for a second
  digitalWrite(4, LOW);    // turn the LED off by making the voltage LOW
  delay(1);
}

No comments:

Post a Comment