Arduino LED Chaser

by knexguy51 in Circuits > Arduino

409 Views, 0 Favorites, 0 Comments

Arduino LED Chaser

LEDchaser.png

A set of astounding lights that goes in patterns. It's basic and insructions are included. This one goes in a rainbow pattern, but you can make yours any color you want!

Supplies

9 LEDs

19 wires

Any arduino board with gnd and at least 9 pins

Any breadboard that fits 9 LEDs

Choose the LEDs

chooseled.png

Choose the 9 LEDs you want. We made it\: red, orange, yellow, green, blue,white,red, red, red.

Connecting the LEDs to the Gnd

groundattached.png

Connect all the LED negative pins to gnd with wires.

Using Pins 1-9

LEDchaser.png

Connect each led positive side to a pin, from the first red - TX, to the final red - should be pin 9.

Time to Code, If You Forgot

download (1).jpg

I'll copy and paste, so you can see the code. Here's thhe co

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

}

Like Share Comment and Follow!

set-posts-like-follow-share-comment-social-media-illustration-design-33061488.jpg

Remember to like share comment and follow!