Arduino Uno - LEDs sequential lightings

This is the first project on Arduino UNO and the idea is to create a sequential lighting of LED .
Requirement : Arduino UNO Board
JumperCable: 4
LEDs: 4
2 Ohm resistors : 4
Bread Board : 1

The connection is show as per the video below

The White wire is connected to the GND pin on Arduino Board and -ve on the Bread Board
The Yellow wire is connected to PIN 10 on the Arduino Board 
The Orange wire is connected to PIN 13 on the Arduino Board 
The Red wire is connected to PIN 12 on the Arduino Board 
The Gray wire is connected to PIN 11 on the Arduino Board  

The 2 ohm resistors are connected from the -ve pin and the line 'E' on the bread board
The Leds have one leg longer the the other . This leg is the +ve end  and the -ve end is connected 
along the resistor line

Download Sketch IDE for Arduino project and run the below program


/* A simple program to sequentially turn on and turn off 3 LEDs */ 

int LED_GREEN = 13;
int LED_YELLOW = 12;
int LED_BLUE = 11;
int LED_RED = 10;

void setup() {
   pinMode(LED_RED, OUTPUT);
   pinMode(LED_BLUE, OUTPUT);
   pinMode(LED_YELLOW, OUTPUT);
   pinMode(LED_GREEN, OUTPUT);
}


void loop() {
  digitalWrite(LED_GREEN, HIGH);    // turn on LED1 
  delay(500);                  // wait for 200ms
  digitalWrite(LED_YELLOW, HIGH);    // turn on LED2
  delay(500);                  // wait for 200ms       
  digitalWrite(LED_BLUE, HIGH);    // turn on LED3 
  delay(500);                  // wait for 200ms
  digitalWrite(LED_RED,HIGH);
  delay(500);
  digitalWrite(LED_GREEN, LOW);     // turn off LED1
  delay(600);                  // wait for 300ms
  digitalWrite(LED_YELLOW, LOW);     // turn off LED2
  delay(600);                  // wait for 300ms
  digitalWrite(LED_BLUE, LOW);     // turn off LED3
  delay(600);                  // wait for 300ms before running program all over again
  digitalWrite(LED_RED,LOW);
  delay(600);
}







Comments

Popular posts from this blog

Authentication and Authorization in Web API -Part1

My Gardening Journey 6