Arduino LED Chaser ( With 5 Effects )

4,934

34

3

Introduction: Arduino LED Chaser ( With 5 Effects )

In this tutorial I am going to explain you how to make LED chaser with the help of arduino.
In this led chaser I add 5 patterns.
Follow these steps for making arduino LED chaser.

Step 1: Hardware Required

1. Breadboard x1
2. Arduino uno x1 (with cable )
3. LED x9 ( 3 Red, 3Blue, 3 Green LEDs)
4. Jumper cables

(Note : for more safety of LED you can add resistor)

Step 2: Circuit Connection

1. Add LED's on breadboard according to circuit
diagram connect all LED negative terminal on
negative port of breadboard

2. I add LED in this pattern
R G B R G B R G B
But you can add LED according to your choice.

3. Now connect jumper cables on the positive
side of each LED's

4. Now take arduino and connect 2nd terminals
of these jumper cables with digital pin 1 to 9
of arduino.
(for more safety of your LED you can connect
resistor with positive side of LED and then you
can connect this with digital pins of arduino
by jumper cables)

5. Connect ground pin of arduino with the
negative side of all LED.

Our circuit connection is completed

Step 3: Programming

For programming open arduino IDE software in your computer.
Now copy this code and paste it in arduino IDE

OR download .ino file and open it in arduino IDE


void setup()
{
pinMode(1,OUTPUT);
pinMode(2,OUTPUT);
pinMode(3,OUTPUT);
pinMode(4,OUTPUT);
pinMode(5,OUTPUT);
pinMode(6,OUTPUT);
pinMode(7,OUTPUT);
pinMode(8,OUTPUT);
pinMode(9,OUTPUT);
}

void loop()
{
int i;


// 1st pattern repeat 1 times

for(i=1; i<=10; 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(1000);


//2nd pattern repeat 1 times

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(1000);

//3rd pattern repeat 1 times

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(1000);

//4th pattern repeat 1 times

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(1000);

//5th pattern rpeat 1 time

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(1000);

}

Now upload this code in in your arduino board

Step 4: Testing

So now LED is blinking with all five effects. And each effect is repeated one time

3 People Made This Project!

Recommendations

  • First Time Author Contest

    First Time Author Contest
  • Make it Fly Challenge

    Make it Fly Challenge
  • Metal Contest

    Metal Contest

3 Comments

0
RobBest
RobBest

Tip 11 months ago

Nice project. In order for your LEDs so live a little bit longer you need a current limiting resistor in series. A standard current for a LED is 20 mA. In your design the current will be higher which may destroy your LEDs if they stay on for too long.