Arduino LED Chaser ( With 8 Effects )

by benjamin941229 in Circuits > Arduino

149 Views, 0 Favorites, 0 Comments

Arduino LED Chaser ( With 8 Effects )

IMG_6772 2.jpg

In this project, I rebuild the original one, change the effects from 5 to 8.

Original link: https://www.instructables.com/Arduino-LED-Chaser-With-5-Effects-/

Step 1: Prepare the Material

1. Breadboard x1

2. Arduino uno x1 (with cable )

3. LED x9

4. Jumper cables

( The materials are same as the original one, the difference is in the code)

Step 2: Connection

1.jpg
2.jpg

1. Take Jumper cables from GND to the positive electorate

2. Take Jumper cables and plug to digital pin 1 to 9of Arduino.

3. Connect the ground pin of Arduino with the negative side of all LED light.

Step 3: Code

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); pinMode(10,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 2 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 2 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 2 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);

}

Step 4: Final Video

Arduino