loading
In this tutorial I will show you how to blink 1-12 leds. I have designed the code so that you can insert 1-12 leds but you can edit it so that you can insert 13 or more.

Step 1: Materials

For this project you will need:
Wires
Arduino board
1-12 leds (im using 10)
usb adapter
solderless breadboard

Step 2: Inserting Leds

Take your leds and put them in a row on the breadboard. Make sure you know which side of the led is positive and which side is negative. I like to point the positive side of the led towards the right. Also, keep a one hole spacing in between each led

Step 3:

Now, plug in a medium sized wire into the first hole on the negative row on the top of the breadboard.

Step 4:

Now insert wires in front of every positive side of each led.

Step 5:

Now insert wires in the negative row that you put the medium wire in. now plug those wires into the negative sides of the leds.

Step 6:

Now we have to plug the wires in. Position the arduino board so that you can plug the wires in from arduino pin 1 to arduino pin 12 but it doesnt matter what pin you go up to.

Step 7:

Now plug the negative wire into GND.

Step 8: CODE

int ledPins[] = {
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 };       // an array of pin numbers to which LEDs are attached
int pinCount = 9;

void setup (){
  pinMode (1, OUTPUT);          // different led patterns
  pinMode (2, OUTPUT);
  pinMode (3, OUTPUT);
  pinMode (4, OUTPUT);
  pinMode (5, OUTPUT);
  pinMode (6, OUTPUT);
  pinMode (8, OUTPUT);
  pinMode (7, OUTPUT);
  pinMode (9, OUTPUT);
  pinMode (10, OUTPUT);
  pinMode (11, OUTPUT);
  pinMode (12, OUTPUT);
}

void loop (){
  digitalWrite (1, LOW);
  delay (60);
  digitalWrite (2, LOW);
  delay (59);
  digitalWrite (3, LOW);
  delay (58);
  digitalWrite (4, LOW);
  delay (57);
  digitalWrite (5, LOW);
  delay (56);
  digitalWrite (6, LOW);
  delay (55);
  digitalWrite (7, LOW);
  delay (54);
  digitalWrite (8, LOW);
  delay (53);
  digitalWrite (9, LOW);
  delay (52);
  digitalWrite (10, LOW);
  delay (51);
  digitalWrite (11, LOW);
  delay (50);
  digitalWrite (12, LOW);
  delay (49);
  digitalWrite (1, HIGH);
  delay (48);
  digitalWrite (2, HIGH);
  delay (47);
  digitalWrite (3, HIGH);
  delay (46);
  digitalWrite (4, HIGH);
  delay (45);
  digitalWrite (5, HIGH);
  delay (44);
  digitalWrite (6, HIGH);
  delay (43);
  digitalWrite (7, HIGH);
  delay (42);
  digitalWrite (8, HIGH);
  delay (41);
  digitalWrite (9, HIGH);
  delay (40);
  digitalWrite (10, HIGH);
  delay (39);
  digitalWrite (11, HIGH);
  delay (38);
  digitalWrite (12, HIGH);
 
  delay (37);
  digitalWrite (12, LOW);
  delay (60);
  digitalWrite (11, LOW);
  delay (59);
  digitalWrite (10, LOW);
  delay (58);
  digitalWrite (9, LOW);
  delay (57);
  digitalWrite (8, LOW);
  delay (56);
  digitalWrite (7, LOW);
  delay (55);
  digitalWrite (6, LOW);
  delay (54);
  digitalWrite (5, LOW);
  delay (53);
  digitalWrite (4, LOW);
  delay (52);
  digitalWrite (3, LOW);
  delay (51);
  digitalWrite (2, LOW);
  delay (50);
  digitalWrite (1, LOW);
  delay (49);
  digitalWrite (12, HIGH);
  delay (48);
  digitalWrite (11, HIGH);
  delay (47);
  digitalWrite (10, HIGH);
  delay (46);
  digitalWrite (9, HIGH);
  delay (45);
  digitalWrite (8, HIGH);
  delay (44);
  digitalWrite (7, HIGH);
  delay (43);
  digitalWrite (6, HIGH);
  delay (42);
  digitalWrite (5, HIGH);
  delay (41);
  digitalWrite (4, HIGH);
  delay (40);
  digitalWrite (3, HIGH);
  delay (39);
  digitalWrite (2, HIGH);
  delay (38);
  digitalWrite (1, HIGH);
  delay (37);
 
  digitalWrite (12, HIGH);
  delay (60);
  digitalWrite (11, HIGH);
  delay (59);
  digitalWrite (10, HIGH);
  delay (58);
  digitalWrite (9, HIGH);
  delay (57);
  digitalWrite (8, HIGH);
  delay (56);
  digitalWrite (7, HIGH);
  delay (55);
  digitalWrite (6, HIGH);
  delay (54);
  digitalWrite (5, HIGH);
  delay (53);
  digitalWrite (4, HIGH);
  delay (52);
  digitalWrite (3, HIGH);
  delay (51);
  digitalWrite (2, HIGH);
  delay (50);
  digitalWrite (1, HIGH);
  delay (49);
  digitalWrite (12, LOW);
  delay (48);
  digitalWrite (11, LOW);
  delay (47);
  digitalWrite (10, LOW);
  delay (46);
  digitalWrite (9, LOW);
  delay (45);
  digitalWrite (8, LOW);
  delay (44);
  digitalWrite (7, LOW);
  delay (43);
  digitalWrite (6, LOW);
  delay (42);
  digitalWrite (5, LOW);
  delay (41);
  digitalWrite (4, LOW);
  delay (40);
  digitalWrite (3, LOW);
  delay (39);
  digitalWrite (2, LOW);
  delay (38);
  digitalWrite (1, LOW);
  delay (37);
 
 
   
  digitalWrite (12, HIGH);
  delay (60);
  digitalWrite (10, HIGH);
  delay (59);
  digitalWrite (8, HIGH);
  delay (58);
  digitalWrite (6, HIGH);
  delay (57);
  digitalWrite (4, HIGH);
  delay (56);
  digitalWrite (2, HIGH);
  delay (55);
  digitalWrite (1, HIGH);
  delay (54);
  digitalWrite (3, HIGH);
  delay (53);
  digitalWrite (5, HIGH);
  delay (52);
  digitalWrite (7, HIGH);
  delay (51);
  digitalWrite (9, HIGH);
  delay (50);
  digitalWrite (11, HIGH);
  delay (49);
  digitalWrite (11, LOW);
  delay (48);
  digitalWrite (9, LOW);
  delay (47);
  digitalWrite (7, LOW);
  delay (46);
  digitalWrite (5, LOW);
  delay (45);
  digitalWrite (3, LOW);
  delay (44);
  digitalWrite (1, LOW);
  delay (43);
  digitalWrite (2, LOW);
  delay (42);
  digitalWrite (4, LOW);
  delay (41);
  digitalWrite (6, LOW);
  delay (40);
  digitalWrite (8, LOW);
  delay (39);
  digitalWrite (10, LOW);
  delay (38);
  digitalWrite (12, LOW);
  delay (37);
 
 
 

  digitalWrite (2, HIGH);
  delay (60);
  digitalWrite (4, HIGH);
  delay (59);
  digitalWrite (6, HIGH);
  delay (58);
  digitalWrite (8, HIGH);
  delay (57);
  digitalWrite (10, HIGH);
  delay (56);
  digitalWrite (12, HIGH);
  delay (55);
  digitalWrite (1, HIGH);
  delay (54);
  digitalWrite (3, HIGH);
  delay (53);
  digitalWrite (5, HIGH);
  delay (52);
  digitalWrite (7, HIGH);
  delay (51);
  digitalWrite (9, HIGH);
  delay (50);
  digitalWrite (11, HIGH);
  delay (49);
  digitalWrite (1, LOW);
  delay (48);
  digitalWrite (3, LOW);
  delay (47);
  digitalWrite (5, LOW);
  delay (46);
  digitalWrite (7, LOW);
  delay (45);
  digitalWrite (9, LOW);
  delay (44);
  digitalWrite (11, LOW);
  delay (43);
  digitalWrite (2, LOW);
  delay (42);
  digitalWrite (4, LOW);
  delay (41);
  digitalWrite (6, LOW);
  delay (40);
  digitalWrite (8, LOW);
  delay (39);
  digitalWrite (10, LOW);
  delay (38);
  digitalWrite (12, LOW);
  delay (37); 




  digitalWrite (12, LOW);
  delay (60);
  digitalWrite (11, HIGH);
  delay (59);
  digitalWrite (10, LOW);
  delay (58);
  digitalWrite (9, HIGH);
  delay (57);
  digitalWrite (8, LOW);
  delay (56);
  digitalWrite (7, HIGH);
  delay (55);
  digitalWrite (6, LOW);
  delay (54);
  digitalWrite (5, HIGH);
  delay (53);
  digitalWrite (4, LOW);
  delay (52);
  digitalWrite (3, HIGH);
  delay (51);
  digitalWrite (2, LOW);
  delay (50);
  digitalWrite (1, HIGH);
  delay (49);
  digitalWrite (12, LOW);
  delay (48);
  digitalWrite (11, HIGH);
  delay (47);
  digitalWrite (10, LOW);
  delay (46);
  digitalWrite (9, HIGH);
  delay (45);
  digitalWrite (8, LOW);
  delay (44);
  digitalWrite (7, HIGH);
  delay (43);
  digitalWrite (6, LOW);
  delay (42);
  digitalWrite (5, HIGH);
  delay (41);
  digitalWrite (4, LOW);
  delay (40);
  digitalWrite (3, HIGH);
  delay (39);
  digitalWrite (2, LOW);
  delay (38);
  digitalWrite (1, HIGH);
  delay (37);




  digitalWrite (12, HIGH);
  delay (60);
  digitalWrite (11, LOW);
  delay (59);
  digitalWrite (10, HIGH);
  delay (58);
  digitalWrite (9, LOW);
  delay (57);
  digitalWrite (8, HIGH);
  delay (56);
  digitalWrite (7, LOW);
  delay (55);
  digitalWrite (6, HIGH);
  delay (54);
  digitalWrite (5, LOW);
  delay (53);
  digitalWrite (4, HIGH);
  delay (52);
  digitalWrite (3, LOW);
  delay (51);
  digitalWrite (2, HIGH);
  delay (50);
  digitalWrite (1, LOW);
  delay (49);
  digitalWrite (12, HIGH);
  delay (48);
  digitalWrite (11, LOW);
  delay (47);
  digitalWrite (10, HIGH);
  delay (46);
  digitalWrite (9, LOW);
  delay (45);
  digitalWrite (8, HIGH);
  delay (44);
  digitalWrite (7, LOW);
  delay (43);
  digitalWrite (6, HIGH);
  delay (42);
  digitalWrite (5, LOW);
  delay (41);
  digitalWrite (4, HIGH);
  delay (40);
  digitalWrite (3, LOW);
  delay (39);
  digitalWrite (2, HIGH);
  delay (38);
  digitalWrite (1, LOW);
  delay (37);
 
 
 
 
    digitalWrite (1, LOW);
  delay (60);
  digitalWrite (12, LOW);
  delay (59);
  digitalWrite (2, LOW);
  delay (58);
  digitalWrite (11, LOW);
  delay (57);
  digitalWrite (3, LOW);
  delay (56);
  digitalWrite (10, LOW);
  delay (55);
  digitalWrite (4, LOW);
  delay (54);
  digitalWrite (9, LOW);
  delay (53);
  digitalWrite (5, LOW);
  delay (52);
  digitalWrite (8, LOW);
  delay (51);
  digitalWrite (6, LOW);
  delay (50);
  digitalWrite (7, LOW);
  delay (49);
  digitalWrite (12, HIGH);
  delay (48);
  digitalWrite (1, HIGH);
  delay (47);
  digitalWrite (11, HIGH);
  delay (46);
  digitalWrite (2, HIGH);
  delay (45);
  digitalWrite (10, HIGH);
  delay (44);
  digitalWrite (3, HIGH);
  delay (43);
  digitalWrite (9, HIGH);
  delay (42);
  digitalWrite (4, HIGH);
  delay (41);
  digitalWrite (8, HIGH);
  delay (40);
  digitalWrite (5, HIGH);
  delay (39);
  digitalWrite (7, HIGH);
  delay (38);
  digitalWrite (6, HIGH);
 
 
 
     digitalWrite (12, LOW);
  delay (60);
  digitalWrite (1, LOW);
  delay (59);
  digitalWrite (11, LOW);
  delay (58);
  digitalWrite (2, LOW);
  delay (57);
  digitalWrite (10, LOW);
  delay (56);
  digitalWrite (3, LOW);
  delay (55);
  digitalWrite (9, LOW);
  delay (54);
  digitalWrite (4, LOW);
  delay (53);
  digitalWrite (8, LOW);
  delay (52);
  digitalWrite (5, LOW);
  delay (51);
  digitalWrite (7, LOW);
  delay (50);
  digitalWrite (6, LOW);
  delay (49);
  digitalWrite (1, HIGH);
  delay (48);
  digitalWrite (12, HIGH);
  delay (47);
  digitalWrite (2, HIGH);
  delay (46);
  digitalWrite (11, HIGH);
  delay (45);
  digitalWrite (3, HIGH);
  delay (44);
  digitalWrite (10, HIGH);
  delay (43);
  digitalWrite (4, HIGH);
  delay (42);
  digitalWrite (9, HIGH);
  delay (41);
  digitalWrite (5, HIGH);
  delay (40);
  digitalWrite (8, HIGH);
  delay (39);
  digitalWrite (6, HIGH);
  delay (38);
  digitalWrite (7, HIGH); 
}
<p>The videos are not displaying for me. Does this make the 12 LED array random? Also, is there a way to make it fade in and out randomly?</p>
<p>i see a lot or repetitive code, wonder if it would be easier to use the for loop</p>
<p>I uploaded your code to my HSS (Halloween Scaring System)</p><p>Here are the results</p>
<p>thanks, it worked great</p>
When I was a kid and made blinking LED projects I used SSI TTL ICs, usually there was a 555 timer involved too. How times have changed ...
yeah, everythings alot more simple but the things you can do are amazing

About This Instructable

28,359views

11favorites

License:

More by pato5:Arduino 1-12 blinking led array 
Add instructable to: