Anip Shah
Published © GPL3+

Led Chaser

Leds controlled using Arduino Uno to create some cool visuals like string lights for festivals.

BeginnerFull instructions provided1 hour130
Led Chaser

Things used in this project

Hardware components

5 mm LED: Red
5 mm LED: Red
×2
LED, Blue
LED, Blue
×2
5 mm LED: Green
5 mm LED: Green
×2
Breadboard (generic)
Breadboard (generic)
×1
Arduino UNO
Arduino UNO
×1
Jumper wires (generic)
Jumper wires (generic)
×1

Software apps and online services

Arduino IDE
Arduino IDE

Story

Read more

Schematics

Circuit Diagram

Code

LED Chaser

C/C++
Upload it to Arduino Uno.
void setup()
{
pinMode(1,OUTPUT);
pinMode(2,OUTPUT);
pinMode(3,OUTPUT);
pinMode(4,OUTPUT);
pinMode(5,OUTPUT);
pinMode(6,OUTPUT);

}

void loop()
{
int i;


// 1st pattern
for(i=1; i<=5; i++)
{
digitalWrite(i,HIGH);
delay(50);
digitalWrite(i,LOW);
delay(50);
}

for(i=10; i>=1; i--)
{
digitalWrite(i,HIGH);
delay(50);
digitalWrite(i,LOW);
delay(50);
}
delay(500);


//2nd pattern

for(i=1; i<=10 ; i++)
{
digitalWrite(i,HIGH);
delay(50);
}

for(i=1; i<=10 ; i++)
{
digitalWrite(i,LOW);
delay(50);
}


for(i=10; i>=1 ; i--)
{
digitalWrite(i,HIGH);
delay(50);
}

for(i=10; i>=1 ; i--)
{
digitalWrite(i,LOW);
delay(50);
}
delay(500);

//3rd pattern

for(i=1; i<=10 ; i++)
{
digitalWrite(i,HIGH);
delay(50);
}
for(i=11; i>=1 ; i--)
{
digitalWrite(i,LOW);
delay(50);
}

for(i=10; i>=1 ; i--)
{
digitalWrite(i,HIGH);
delay(50);
}
for(i=1; i<=10 ; i++)
{
digitalWrite(i,LOW);
delay(50);
}
delay(500);

//4th pattern 

for(i=1; i<=5 ; i++)
{
digitalWrite(i,HIGH);
digitalWrite(11-i,HIGH);
delay(100);
}
for(i=1; i<=5 ; i++)
{
digitalWrite(i,LOW);
digitalWrite(11-i,LOW);
delay(100);
}
delay(100);
for(i=1; i<=5 ; i++)
{
digitalWrite(i,HIGH);
digitalWrite(11-i,HIGH);
delay(100);
}
for(i=5; i>=1 ; i--)
{
digitalWrite(i,LOW);
digitalWrite(11-i,LOW);
delay(100);
}
delay(500);

//5th pattern 

for(i=1 ; i<=3 ; i++)
{
digitalWrite(i,HIGH);
digitalWrite(i+3,HIGH);
digitalWrite(i+6,HIGH);
delay(500/i);
}
delay(500);

for(i=1 ; i<=3 ; i++)
{
digitalWrite(i,LOW);
digitalWrite(i+3,LOW);
digitalWrite(i+6,LOW);
delay(500/i);
}

delay(500);

}

Credits

Anip Shah

Anip Shah

9 projects • 4 followers
Tech enthusiast and programmer who also happens to be a Biomedical Engineer.

Comments