Go Down

Topic: Help?? (Read 2569 times) previous topic - next topic

lwa223

Alright, I want to control four LEDs individually through my Arduino. I assume I'll have to use the breadboard, but I simply cannot find a tutorial on blinking multiple LEDs, let alone controlling it.

The code, I feel, will be fairly simple. I am lost on the circuitry and schematic and wiring and all that.

Link or help please? 0:-)

Grumpy_Mike

#1
Jul 14, 2011, 06:12 pm Last Edit: Jul 14, 2011, 06:14 pm by Grumpy_Mike Reason: 1
Output pin -> resistor 220R -> anode of LED -> cathode of LED -> ground.

http://www.arduino.cc/en/Tutorial/Blink

Do it 4 times with different pins.


lwa223

Thank you for your reply and link! :)

But how do I connect the wires on the breadboard? I don't have that many ground pins... inputs.

Grumpy_Mike

Quote
But how do I connect the wires on the breadboard?

I am a bit puzzled about what you don't understand. You get wire, strip a bit of insulation off the end and push it in the hole. Do the same for the other end and make a connection.

lwa223

I'm sorry, I'm really new to Arduino and I don't understand a lot (obviously).

I mean that I only have a limited number of places to connect a ground wire to. I don't really understand how to connect three to four LEDs to a ground wire...

I'm sorry... :(

Grumpy_Mike

Wire all the pins together on the bread board and then take one wire from the bread board and connect it to the ground on the arduino. All are at the same potential.

lwa223

Alright, thank you.

It doesn't matter where on the Bread Board?

Grumpy_Mike

No as long as they are connected together and not connected to any other signal the it physically doesn't matter where they are. It is only important where the electricity can flow.

lwa223

Alright, thank you very much! I've managed to blink two LEDs... Working on the 3rd.

I really appreciate it!

lwa223

The LEDs on the Bread Board are really dim.... What does that mean I'm doing wrong?

Grumpy_Mike

Either too much resistance or you haven't set the pins as outputs using the pinMode() function in the setup()

lwa223

You just have to do pinMode(LED, OUTPUT), right?
Because I did that :(

An LED plugged directly into the board is very bright. The first LED plugged into the BreadBoard is half lit. The second into the breadboard is so low that I have to cup my hands to see if it's lit. I'm assuming this is a resistance problem then. So, get smaller resistors?

Grumpy_Mike

You need a resistor in line with each LED. What value are you using?
You need to connect each LED to a different output pin and program up each one separately.

retrolefty


You just have to do pinMode(LED, OUTPUT), right?
Because I did that :(

An LED plugged directly into the board is very bright. The first LED plugged into the BreadBoard is half lit. The second into the breadboard is so low that I have to cup my hands to see if it's lit. I'm assuming this is a resistance problem then. So, get smaller resistors?


Well it's pinMode(PinNumber, OUTPUT); so you have to have declared the pin number correctly for the output pins you are wiring to. Post your code if you want us to see if you did everything correctly. What size resistors are you using, just anyone you grab doesn't work well? 220 to 1,000 should be fine to make it work without burning up an output pin. Higher then that and they can work but will be dimmer.

Lefty


lwa223

#define LED1 13
#define LED2 12
#define LED3 11
#define LED4 10

void setup()
{
  pinMode(LED1, OUTPUT);
  pinMode(LED2, OUTPUT);

}

void loop()
{
  digitalWrite(LED1, HIGH);
digitalWrite(LED2, HIGH);
}


---

Go Up