Introduction: Dirt Cheap Arduino LED Light Bar!

Picture of Dirt Cheap Arduino LED Light Bar!

This instructable was designed for beginners in mind, but advanced users can easily adapt it to fit their needs and wants. It only uses a few common components, so you shouldn't have much trouble putting this together. It's a good waste of 5 minutes with a satisfying result (at least in my experience), and everything is ready for you to adapt and customize. It's super cheap and super simple, requires NO breadboarding, and is a good follow-up to blinking and fading an LED. If you're a beginner who's tired of just using one LED on the Arduino, look here! If you're not yet the owner of a breadboard, stay tuned! If you're still reading this, then stop looking at this infomercial and get on with the project!

Step 1: Gather Your Materials.

Picture of Gather Your Materials.

There aren't a lot of them, but all of them are needed! You'll need:

-An Arduino
-Some LEDs (I suggest starting with 7, but you can use 14 if you want to!)
-An insulated wire about as long as the Arduino.

At minimum, the wire can be 1 1/2in (or 4cm, for those readers that like the metric system. Go metric!). As proof that it will work, you can insert the wire into the GND pin next to the AREF pin. If the wire can reach Digital I/O pin 0 without much trouble, you're good to go.

Don't worry about the LED's forward voltage, because you'll only be using them in short bursts that won't be enough to fry them. My LEDs were each at around 3FV, or 3 forward volts. This is the common amount for most LEDs. If you do decide to use LEDs with a smaller forward voltage, beware. Also, if you adapt the program sampled here and change the delay speed, you might fry your pretty lights! Be careful! If you DO plan to leave an LED on for a prolonged period of time, a 100ohm resistor connected to it should do the trick.

Step 2: Strip the Wire.

Picture of Strip the Wire.

There really isn't much to this step. Take your insulated wire and remove the insulation. If you have pliers, use them and your fingernails. Have patience! It has to be a solid-core wire for this to work. Otherwise, you'll have a lot of tiny strands of metal cluttering your workspace that's a pain to clean up.

If you have a jumper wire set you bought from Radioshack, with the compartment box and color-coded wire lengths, use the larger red one! It is a perfect size for this project, leaving just enough space to form a "hook" around the female header pins to make it stay in place.

Step 3: Form the Wire.

Picture of Form the Wire.

Insert the wire into the GND pin next to the AREF pin so that it's sticking straight up. Now, bend it so it is pointing down, sticking straight out towards you. Finally, bend it one more time 90 degrees, running parallel with the rest of the digital pins to create your ground rail. If you press the wire against the header pins, the protruding LED cathode wires should touch it. It is essential that all the cathodes of the LEDs touch the stripped wire, or else they won't make a complete circuit and therefore won't light up!

Step 4: Insert the LEDs Into the Corresponding Pins.

Picture of Insert the LEDs Into the Corresponding Pins.

If you decided to use only 7 LEDs, insert them into each even numbered I/O pin. This means you should have inserted one LED into pins 0, 2, 4, 6, 8, 10, and 12. Remember, the anode (positive lead) is the longer one and is the one that should go into the pin! Leave the cathode (negative lead) hanging outside the pin.

If you plan to use a breadboard, you might want to just jumper the pins directly to the breadboard and insert the LEDs there. However, if you are planning to do so just to make yourself look cool, it's not worth it! It takes forever to insert each wire into each pin on the Arduino and breadboard. Do so only if you have to! (This means if you plan to use imputs to affect the LEDs, breadboard it. If you're content with a simple light bar, leave it as it is.)

If you are doing this project for the first time or plan to use imputs, use 7 LEDs. This will (1) leave room for the imput pins you plan to use, and (2) allow spacing for the LEDs to not bunch up and become a big mess.

Also, if you plan to use 14 LEDs, taking advantage of all of the I/O pins on the Arduino, I recommend breadboarding it as well. Heck, rule of thumb: When in doubt, breadboard it!

Step 5: Download the Program.

Picture of Download the Program.

Okay, I lied about the downloading part. My computer's not cooperating, so I'm going to have to just copy and paste the programs right into the instructable.

Okay, if you'd like the 7-pin LED bar, copy and paste this into the Arduino IDE:


//Super Simple LED Light Bar with only odd I/O pins!

void setup() { pinMode(0, OUTPUT);
pinMode(2, OUTPUT); pinMode(4, OUTPUT);
pinMode(6, OUTPUT); pinMode(8, OUTPUT);
pinMode(10, OUTPUT); pinMode(12, OUTPUT);
}
void loop() { digitalWrite(12, LOW);
digitalWrite(0, HIGH); delay(100);
digitalWrite(2, HIGH);
digitalWrite(0, LOW);
delay(100);
digitalWrite(4, HIGH);
digitalWrite(2, LOW);
delay(100);
digitalWrite(6, HIGH);
digitalWrite(4, LOW);
delay(100);
digitalWrite(8, HIGH);
digitalWrite(6, LOW);
delay(100);
digitalWrite(10, HIGH);
digitalWrite(8, LOW);
delay(100);
digitalWrite(12, HIGH);
digitalWrite(10, LOW);
delay(100);
digitalWrite(10, HIGH);
digitalWrite(12, LOW);
delay(100);
digitalWrite(8, HIGH);
digitalWrite(10, LOW);
delay(100);
digitalWrite(6, HIGH);
digitalWrite(8, LOW);
delay(100);
digitalWrite(4, HIGH);
digitalWrite(6, LOW);
delay(100);
digitalWrite(2, HIGH);
digitalWrite(4, LOW);
delay(100);
digitalWrite(2, LOW);
}

/* If you'd like the light to "bounce, cut and paste this
into the voidloop() function, right between digitalWrite(10, LOW);
and the final bracket.

digitalWrite(10, HIGH);
digitalWrite(12, LOW);
delay(100);
digitalWrite(8, HIGH);
digitalWrite(10, LOW);
delay(100);
digitalWrite(6, HIGH);
digitalWrite(8, LOW);
delay(100);
digitalWrite(4, HIGH);
digitalWrite(6, LOW);
delay(100);
digitalWrite(2, HIGH);
digitalWrite(4, LOW);
delay(100);
digitalWrite(2, LOW);

*/

And if you'd like the 14 LED Light Bar, copy and paste this program into the Arduino IDE:

//LED Light Bar; all I/O pins used!

void setup() { pinMode(0, OUTPUT);
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);
pinMode(11, OUTPUT); pinMode(12, OUTPUT);
pinMode(13, OUTPUT);}

void loop() { digitalWrite(0, HIGH);
delay(100); digitalWrite(1, HIGH);
digitalWrite(0, LOW); delay(100);
digitalWrite(2, HIGH); digitalWrite(1, LOW);
delay(100); digitalWrite(3, HIGH);
digitalWrite(2, LOW); delay(100);
digitalWrite(4, HIGH); digitalWrite(3, LOW);
delay(100); digitalWrite(6, HIGH);
digitalWrite(4, LOW); delay(100);
digitalWrite(7, HIGH); digitalWrite(6, LOW);
delay(100); digitalWrite(8, HIGH);
digitalWrite(7, LOW); delay(100);
digitalWrite(9, HIGH); digitalWrite(8, LOW);
delay(100); digitalWrite(10, HIGH);
digitalWrite(9, LOW); delay(100);
digitalWrite(11, HIGH); digitalWrite(10, LOW);
delay(100); digitalWrite(12, HIGH);
digitalWrite(11, LOW); delay(100);
digitalWrite(13, HIGH); digitalWrite(12, LOW);
delay(100); digitalWrite(13, LOW);
}

Step 6: Customize!

Picture of Customize!

Customize it! This design is very easily altered. You can replace LEDs with different colors, change the delay function to make the line go slower or faster, or even go very slowly at first, then slingshot forward! It might take some fine-tuning when you first hook up the program to the Arduino. You'll know an LED needs to be adjusted to touch the ground wire if it doesn't turn on.

Have fun!

Comments

KabirJ4 (author)2016-10-19

what gauge is the wire and any recommendations on where to buy it?

m6255 (author)2016-04-28

Ive always read you should always include resistors not just to protect the LEDs bit the Arduino board as well. Just sayin

quadrizone (author)2012-04-01

Hey, can someone help me do a "bar graph" effect... that is, turn on each led in order on by one (and stay on) until the last led goes on, then they all turn back off in the order they turned on?

Genius 470 (author)quadrizone2014-09-18

I think this is the link your looking for https://www.instructables.com/id/Arduino-Knight-Rider-With-LED-Bargraph-/

yousuffarooq1 (author)2012-09-07

Great instructable deffinatley following u

pfred2 (author)2011-11-10

Grow up.

bigjeff5 (author)pfred22012-06-18

I think you misunderstood who he was saying was a 13-year-old teen, though to be fair you you don't seem to pay much attention to what other people say so I can understand why you were confused.

Voltage drop when talking about LED's (and other passive components) is the voltage at which internal resistance begins to rise. As more voltage is applied the resistance will increase and the internal circuits will begin to heat up. If the voltage goes too high for too long, the internal components will get hot enough to melt, and that's when the LED burns out. An LED with a 3v drop can usually handle up to 3.5v or so for extended periods of time. Above that they will eventually burn out, with higher voltages causing it to burn out faster.

Ohm's law is I=V/R, or Amps = Volts/Ohms.

First of all, source amps don't matter except as far as resistor maximum capacity. For example, you don't want to use a 2 amp resistor with a 20 amp source - it will fry the resistor and then your whole project and possibly kill you, because 20 amps is way more than necessary to the job.

So, if we have a 5v source and we want to get that down to 3v @ 20ma, then we need to add enough resistance to drop 2 volts at 20ma. Thus:

Ohms = 2V/0.02a

Which is 100.

To run a 3v LED at 10ma, you need a 200 ohm resistor (2v/0.01a=200).

To run a 3v LED at 20ma from a 9v source you need a 300 ohm resistor (6v/0.02=300).

All of this is in the linked instructable you wouldn't read because it was referred to you by a 13 year old. Who's grown up here?

markie (author)2011-12-31

Hi,
i have changed the code so you can use the pot for 14 led`s
here`s the code, have fun!!

int sensorPin = A0; // select the input pin for the potentiometer
int ledPin = 13; // select the pin for the LED
int sensorValue = 0; // variable to store the value coming from the sensor


void setup() {
pinMode(13, OUTPUT);
pinMode(12, OUTPUT);
pinMode(11, OUTPUT);
pinMode(10, OUTPUT);
pinMode(9, OUTPUT);
pinMode(8, OUTPUT);
pinMode(7, OUTPUT);
pinMode(6, OUTPUT);
pinMode(5, OUTPUT);
pinMode(4, OUTPUT);
pinMode(3, OUTPUT);
pinMode(2, OUTPUT);
pinMode(1, OUTPUT);
pinMode(0, OUTPUT);
}

void loop() {
sensorValue = analogRead(sensorPin);
digitalWrite(13, HIGH);
delay(sensorValue);
sensorValue = analogRead(sensorPin);
digitalWrite(12, HIGH);
delay(sensorValue);
sensorValue = analogRead(sensorPin);
digitalWrite(13, LOW);
digitalWrite(11, HIGH);
delay(sensorValue);
sensorValue = analogRead(sensorPin);
digitalWrite(12, LOW);
digitalWrite(10, HIGH);
delay(sensorValue);
sensorValue = analogRead(sensorPin);
digitalWrite(11, LOW);
digitalWrite(9, HIGH);
delay(sensorValue);
sensorValue = analogRead(sensorPin);
digitalWrite(10, LOW);
digitalWrite(8, HIGH);
delay(sensorValue);
sensorValue = analogRead(sensorPin);
digitalWrite(9, LOW);
digitalWrite(7, HIGH);
delay(sensorValue);
sensorValue = analogRead(sensorPin);
digitalWrite(8, LOW);
digitalWrite(6, HIGH);
delay(sensorValue);
sensorValue = analogRead(sensorPin);
digitalWrite(7, LOW);
digitalWrite(6, HIGH);
delay(sensorValue);
sensorValue = analogRead(sensorPin);
digitalWrite(6, LOW);
digitalWrite(5, HIGH);
delay(sensorValue);
sensorValue = analogRead(sensorPin);
digitalWrite(5, LOW);
digitalWrite(4, HIGH);
delay(sensorValue);
sensorValue = analogRead(sensorPin);
digitalWrite(4, LOW);
digitalWrite(3, HIGH);
delay(sensorValue);
sensorValue = analogRead(sensorPin);
digitalWrite(3, LOW);
digitalWrite(2, HIGH);
delay(sensorValue);
sensorValue = analogRead(sensorPin);
digitalWrite(2, LOW);
digitalWrite(1, HIGH);
delay(sensorValue);
sensorValue = analogRead(sensorPin);
digitalWrite(1, LOW);
digitalWrite(0, HIGH);
delay(sensorValue);
sensorValue = analogRead(sensorPin);
digitalWrite(1, LOW);
digitalWrite(0, LOW);


}

DeanGPotts (author)markie2012-06-17

You can double that if you have 2 led's per pin, one working when its a high input, one when its an high output, and both off when the pin is set to low. when you can control atleast 37 led's and 1 push switch you could make a roulette game or something similar.
only a quick thought if it helps or gives you any ideas.

alexw2150 (author)markie2012-01-01

Cool, I got bored after 5 leds... :)

Boedy Arthana (author)2012-02-10

help to run program after uploading, i'm a newbie
is not work,

kevinrams (author)2012-02-02

Thanks I just got my first Arduino yesterday. I did the blink test first and this instructable as my first 'project' Nice and simple in construction and understanding the code. Keep em' coming.

Aperture Laboratories (author)2011-12-27

cool!!

Aperture Laboratories (author)2011-12-03

Can you send me the codefor the pot so I can very the speed

/*
Put a LED on pin 13 and connect the other pin to ground
" " " " " 12 " " " " " " "
" " " " " 11 " " " " " " "
" " " " " 10 " " " " " " "
" " " " " 9 " " " " " " "
" " " " " 8 " " " " " " "
" " " " " 7 " " " " " " "

Put the center pin of the potentiometer to analog pin 0
Put a side pin of the potentiometer (either one) to ground
The other side pin to +5V
*/


int sensorPin = A0; // select the input pin for the potentiometer
int ledPin = 13; // select the pin for the LED
int sensorValue = 0; // variable to store the value coming from the sensor


void setup() {
pinMode(13, OUTPUT);
pinMode(12, OUTPUT);
pinMode(11, OUTPUT);
pinMode(10, OUTPUT);
pinMode(9, OUTPUT);
pinMode(8, OUTPUT);
pinMode(7, OUTPUT);
}

void loop() {
sensorValue = analogRead(sensorPin);
digitalWrite(13, HIGH);
delay(sensorValue);
sensorValue = analogRead(sensorPin);
digitalWrite(12, HIGH);
delay(sensorValue);
sensorValue = analogRead(sensorPin);
digitalWrite(13, LOW);
digitalWrite(11, HIGH);
delay(sensorValue);
sensorValue = analogRead(sensorPin);
digitalWrite(12, LOW);
digitalWrite(10, HIGH);
delay(sensorValue);
sensorValue = analogRead(sensorPin);
digitalWrite(11, LOW);
digitalWrite(9, HIGH);
delay(sensorValue);
sensorValue = analogRead(sensorPin);
digitalWrite(10, LOW);
digitalWrite(8, HIGH);
delay(sensorValue);
sensorValue = analogRead(sensorPin);
digitalWrite(9, LOW);
digitalWrite(7, HIGH);
delay(sensorValue);
sensorValue = analogRead(sensorPin);
digitalWrite(8, LOW);
digitalWrite(7, LOW);


}


alexw2150 (author)2011-11-14

Cool, I did this then added a variable resistor, to change the speed you I could also put the leds on the analog pins and made them fade in and out.

ForgerOfPie (author)alexw21502011-12-03

Um... the "analog in" pins are made for taking analog INPUTS, not outputs. The PWM pins act as analog output pins. I think you knew that, just got mixed up a bit. Don't worry, I'm dyslexic, it happens to me all the time. ;-)

alexw2150 (author)ForgerOfPie2011-12-24

True, you can also do this http://www.arduino.cc/en/Tutorial/AnalogInputPins

Aperture Laboratories (author)2011-12-03

Thx a lot

Aperture Laboratories (author)2011-12-02

can you add resistors and add a breadboard to put it on

Yup. Would you like a diagram of how to do that?

dudleyjohn (author)2011-11-15

I like this instructable. I ran an LED without a resistor (on flash) for about an hour with no burnout. I assume the life of the LED was being shortened, but since this was not a permanent device, who cares. btw- it's "input" Good job!

Djandco (author)2011-11-11

Despite the rather silly people who prefer to ridicule rather than keep their mouth shut I appreciate the time and effort people like yourself, who take time to create an instructable.
We all start somewhere and like myself, we learn from each other.
I have just started on the journey so lets see where it takes us :-)

ForgerOfPie (author)Djandco2011-11-12

Gracias, mi amigo.

wunderdog317 (author)2011-11-10

what is the code going to do a larson scanner hopefully

ForgerOfPie (author)wunderdog3172011-11-11

The code is on step 5. If you want to make it "bounce" with 7 LEDs, I've already included that, but if you're going to use 14 LEDs, I'll have to make time to do that, since I haven't already. Just one more thing on the to-do list.

Teslaling (author)2011-10-24

I don't mean to be rude, but I only count 7 LEDs.

Other than that, great instructable! (5*)

pfred2 (author)Teslaling2011-11-09

I want to know what they mean by, "Dirt cheap" in the title.

Like you I say, other than that, great instructable!

ForgerOfPie (author)pfred22011-11-09

Dirt cheap is a phrase that means "little to no cost." I bought all of the LEDs for about $1. The only other component is a wire, and that I scrounged from my busted radio.

(By the way, if you want to know the exact cost of the LEDs, it was $1.05. I got each one for 15 cents.)

pfred2 (author)ForgerOfPie2011-11-10

So the UNO was free?

Teslaling (author)pfred22011-11-10

I think that TheUselessPerson was implying that anybody that has an Arduino can make a LED Light Bar very cheaply.

pfred2 (author)Teslaling2011-11-09

Well when UNOs sprout on trees here maybe I'll have one too? Until that day arrives I'm going to have to just think globally and drink locally.

ForgerOfPie (author)pfred22011-11-10

Look, this was meant as a simple beginner's project for a person that has just bought an Arduino. I know that MY experience with the Arduino was that I blinked an LED, I faded an LED, and I set the Arduino down for about 3 months. I didn't want that to happen with others, so I made this really simple project.

And if you're trying to be a smart-mouth (or smart-text, whichever you prefer,) please stop. I mean that in the nicest possible way.

pfred2 (author)ForgerOfPie2011-11-10

Do you?

ForgerOfPie (author)pfred22011-11-10

Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes. Yes.

pfred2 (author)ForgerOfPie2011-11-10

Seek help.

ForgerOfPie (author)Teslaling2011-10-26

Wow. Just wow. I meant to change that, but apparently I forgot. Maybe dyslexia isn't the only thing I have. Short term memory loss as well?

tigerbomb8 (author)2011-10-28

you should really have some resistors in there

ForgerOfPie (author)tigerbomb82011-10-28

The LEDs are on for only a fraction of a second, and they haven't blown up yet on mine. I left it on for 6 hours and they work great. However, if you plan to slow down and keep an LED lit for a prolonged period of time, use a 100 ohm resistor.

pfred2 (author)ForgerOfPie2011-11-09

I never used one of these boards but reading their website it seems the outputs are 5 volts so are you sure LEDs only need 100 Ohms at 5 volts? I guess the LEDs you're using are fairly powerful ones. They sure look it. Plain old LEDs at 5 volts need about 330 Ohms to limit the current they get.

ForgerOfPie (author)pfred22011-11-09

I used http://ledcalculator.net/. I put the power supply voltage at 5, the LED voltage drop at 3, and the LED current rating at 20. There was only 1 LED, and it came up with 100 ohms, so that's what I posted here.

pfred2 (author)ForgerOfPie2011-11-10

I don't understand what , "the LED voltage drop at 3" means. Does that mean you wanted to run the LED at 3 volts or putting the LED in circuit would drop the voltage by 3 volts?

20ma is higher than many LEDs can handle. Ones that need 330 Ohm resistors typically use around 10ma.

What resistor you need is determined by an individual LEDs current rating. That value does vary depending on the particular LED you are using. So unless you specify what current LEDs to use you cannot really specify what current limiting resistor is needed either.

Must be why there is that online LED calculator you used don't you think?

pfred2 (author)ForgerOfPie2011-11-10

Why would you say that? I already know why you would, but I'd like you to say it.

R.ik (author)2011-10-23

Isn't it easier to just use a variable for the pins and do this with some simple FOR loops?

ForgerOfPie (author)R.ik2011-10-23

If you'd like to cook that up and submit it to me, I'd be glad to change it.

R.ik (author)ForgerOfPie2011-10-24

Hi, Just putted something together. No libraries are needed, AFAIK. I'm new to this myself too, but learned some stuff about loops while coding on my TI 84-Plus during classes :P
Here's my code, it should do just the same as the part of your code until the /* bounce part. Haven't test it though, so please tell me if it gives an errors... Pro of using for loops is that you can repeat similar pieces of code as many times as you want with just a little bit of code, but I agree with you that this makes the code more complex and harder to understand .
void setup(){int counter = 0; //declaring a variable which is used in the for loops
for(counter=0, counter<7, counter++){//starts if counter is 0, adds one to "counter" everytime it loops until counter has reached the value of 7
pinMode(counter*2, OUTPUT);
}
}
void loop() {
counter =0;
digitalWrite(12, LOW);
digitalWrite(0, HIGH);
delay(100);
for(counter=0,counter<7,counter++){//same here
digitalWrite((counter+1)*2),HIGH);//Noticed that the pin set to HIGH is always two HIgher than the pin set to LOW
digitalWrite(counter*2,LOW);
delay(100);
}
counter=6
for(counter=6,counter>1,counter--){//same as the first part, but now decreasing
digitalWrite((counter-1)*2),HIGH);// HIGH pin is now always two lower
digitalWrite(counter*2,LOW);
delay(100);
}
digitalWrite(2, LOW);
}

hightekrednek2396 (author)R.ik2011-10-27

its got a lot of compiling errors but i think i got most of them out plus you cant use straight c statement in arduino. just because it gets picky sometimes

Did you try actually using it on the Arduino with this project and your coding? If not, can you do so just to make sure it works? Thnx.

yep i tried it on my uno it works great
but ill paste the new code

About This Instructable

24,748views

71favorites

License:

Bio: I'm 13, use proper grammar, and (if that wasn't odd enough) am really good with people, so feel free to ask me anything.
More by ForgerOfPie:Dirt cheap Arduino LED light bar!Good 'n Simple Paper Airplane: No Cutting, Gluing, or Taping Nuthin'
Add instructable to: