STARTING WITH AN ARDUINO



How much time do you spend with the work you love?Have you  found the field of your interest yet? If not keep on searching don't settle. Even if  you have found your point of interest  it doesn't mean you will be getting better and better.You need to work and work.


                                                   ARDUINO:Traffic Light System

Today we will be playing with some LED's , resistors and the Arduino to make a circuit which would be relaying our general traffic light system.

First thing you need to prepare the materials required as follows:

  1. Breadboard
  2. Some jumper wires
  3. LED :red ,yellow and green each
  4. Three 330 ohm resistors
  5. Arduino
  6. PC  with Arduino IDE platform

  • You need to place the three leds in the order of red, yellow and green from left to right in the bread board.Space them well to manage wires.
  • Bring a ground from the arduino with the help of a jumper wire and make a line segment in the breadboard grounded.After that connect all the cathodes of the LED's(the shorter part) to the ground.
  • Then connect the 330ohm resistor to the anode part of 3 different LEDs.The other end of resistors is now connected to the  3 different desired digital number in Arduino.For example, I took red-5,yellow-6 and green-9.Now your circuit is ready.


  • The thing left is some programming.Open your Arduino IDE on your PC. Now you should know how a traffic light works. First let us suppose red is glown for 10 seconds and when the red is glowing for 9th and 10th second yellow is also turned on for the last 2 second .This is the indication that the light is going to change to green.The green is glown for 10 seconds and switches to yellow light for 2 seconds . Now it shifts to red and finally the loop is continuing again and again.You can try coding yourself it is not that difficult. If you have problem then see the code below:

-------------------------------------------------------------------------------------------------------------------------
int red=5;
int yellow=6;
int green=9;
void setup() {
  pinMode(red, OUTPUT);
  pinMode(yellow, OUTPUT);
  pinMode(green, OUTPUT);
}

// the loop function runs over and over again forever
void loop() {
digitalWrite(red, HIGH);   
delay(10000);   
digitalWrite(yellow, HIGH);     
delay(2000);  
digitalWrite(red, LOW);   
digitalWrite(yellow, LOW);   
 digitalWrite(green, HIGH);    
 delay(10000);     
 digitalWrite(green, LOW);
digitalWrite(yellow, HIGH);     
delay(2000);      
digitalWrite(yellow, LOW);  
       
}
--------------------------------------------------------------------------------------------------------------------------
Have a look on the video I took after the project was complete.




Comments

Popular posts from this blog

Evolution of Smartphones

Our Memories