How to Make TRAFFIC LIGHT Arduino

            In this post I will make one project arduino uno. Project this time I will make the traffic lights like on the highway, but I use arduino, to make it more simple in aplikasian in this project.
The first - all we need some electronic components that many have encountered on the market.
Electronic components are needed:

  1. Red LED Lamp (1 Piece)
  2. Yellow LED Lights (1 Piece)
  3. Green LED Lights (1 Piece)
  4. Arduino Uno (1 Piece)
  5. Jumper Cables (Moderation)
  6. Power Supply 5 Volt Arduino
  7. Project Board

     The above is a component - Electronic components are needed to make the project this time.
Traffic Lights schemes

Traffic Lights schemes


Traffic Lights Arduino schemes

Traffic Lights Arduino schemes 


Sketch of Traffic Lights




// Free Tutorial Arduino
// www.ioisalman.com

int redPin = 7; // Red light
int yellowPin = 6; // Yellow Lights
greenPin int = 5; // Green light

void setup ()
{
      pinMode (redPin, OUTPUT);
      pinMode (yellowPin, OUTPUT);
      pinMode (greenPin, OUTPUT);
}
void loop ()
{
     digitalWrite (redPin, HIGH); // Red Lights On
     digitalWrite (yellowPin, LOW);
     digitalWrite (greenPin, LOW);
     delay (3000); // Pause 3 seconds
     digitalWrite (redPin, LOW); // Yellow Lights On
     digitalWrite (yellowPin, HIGH);
     digitalWrite (greenPin, LOW);
     delay (3000); // Pause 3 seconds
     digitalWrite (redPin, LOW); // Green Light On
     digitalWrite (yellowPin, LOW);
     digitalWrite (greenPin, HIGH);
     delay (3000); // Pause 3 seconds
} 


Note:

- Make the traffic lights in this order: Red - Yellow (blinking 3x) - Green

instructions:

Line program for Yellow light:

     digitalWrite (redPin, LOW); // Yellow Lights On
     digitalWrite (yellowPin, HIGH);
     digitalWrite (greenPin, LOW);
     delay (3000); // Pause 3 seconds

replaced:

   for (int i = 1; i <= 3; i ++)
   {
     digitalWrite (yellowPin, HIGH);
     delay (1000);
     digitalWrite (yellowPin, LOW);
     delay (1000);
   }

Subscribe to receive free email updates:

0 Response to "How to Make TRAFFIC LIGHT Arduino"

Post a Comment