fbpx

Course

Elaborate 1: Waterfall Pattern with LEDs

Objective:

Blink Five LED in Waterfall Pattern

Schematics:

Connections:

Reference Picture:

Ardublock

Click on Ardublock to open the Ardublock window and put the following blocks together.

Arduino Code

void setup(){
    pinMode(2,OUTPUT);  //Set pins D2 to D6 as outputs
    pinMode(3,OUTPUT);
    pinMode(4,OUTPUT);
    pinMode(5,OUTPUT);
    pinMode(6,OUTPUT);
}
void loop(){
    digitalWrite(2,HIGH);   //Turn ON LEDs one by one
    delay(1000);    
    digitalWrite(3,HIGH);
    delay(1000);
    digitalWrite(4,HIGH);
    delay(1000);
    digitalWrite(5,HIGH);
    delay(1000);          
    digitalWrite(6,HIGH); 
    delay(1000);
    digitalWrite(2,LOW);   //Turn OFF all LEDs
    digitalWrite(3,LOW);
    digitalWrite(4,LOW);
    digitalWrite(5,LOW);
    digitalWrite(6,LOW);
    delay(1000);
}

Output

Upload the following program on Arduino after connecting the Arduino to laptop and making changes in board and port tab, you will see the 5 LED in waterfall pattern

Explanation:

We start by lighting one LED at a time and delaying in between.The we switch everything off and repeat the step over.

Leave a Reply