Ok so I have not messed around with my Arduino Duemilanove for a while now since I have been busy, however tonight I dusted it of and have started on a simply task. But I am a little stuck already!
Ok so the idea is that I have a potentiometer attached to my Arduino which has a value that ranges from 0-1023 and the value that it is on determines whether a red, yellow or green LED is lit. Ok so I am ok with the coding and so far have got to the point where the first LED is lit when the value is between 0-160. My problem is that the LED is very dull and so I want to add more power using a 3v power pack. However I do not know how to attach it. I have tried it in a few locations but the first caused the LED to stay constantly lit, the second lit all three LED's and the third caused the all the LED's to light up but the brighness changed depending on the potentiometers position??? Any help would be great!
You don't need more "power" you need more "current." If you are only driving one LED (with a current limiting resistor!) and it is very dull you probably forgot to set your pins to OUTPUT.
When asking questions, it is helpful to include diagrams and/or code.
I want to add more power using a 3v power pack. However I do not know how to attach it.
Connecting a power pack directly to the arduino in any way is a good way to damage the arduino, as well as being a totally useless way of powering an LED.
There is no need to use an external power pack to get the current in an LED to be greater than 40mA because the arduino pin can source or sink that much and it is more than most LEDs can take. If you do have to use external power then you MUST use something to drive it like a transistor.
It is likely the LED is dim because you have the wrong value of current limiting resistor, if it is not what James said.
No sorry, when I said I forgot to put the resistors in I mean in real life not the diagram and the LED's are exactly the same brightness with or without the resistors in place. Well at least I think they are 2.0 k ohm, I have used my iPhone app to check using the stripes on them. Ok so should I use a 220 ohm resistor or is that the same as 2.0 K ohm? Sorry for being such a noob!
Thanks Mike I will give a 220 ohm resistor a try. And thanks for making me feel so welcome floresta with your sarcastic answers making me feel so stupid and as if I should give up now. It is always nice to get some positive help when trying out a new hobby.
My board does not have a +5v, just 5v but I am guessing that is what you mean? I have tried it and they are much brighter, but then they will be constantly on and not just on when the coding tells them to be?
No it is actually +5V, there is no such thing as 5V because a voltage is only able to be measured with reference to another point. So a point can only be +5V of another point or -5V of another point, to say it is 5V only without a sign has no meaning.
and not just on when the coding tells them to be?
That is the first mention of code in the post. Can you say what it is doing? Is it operating PWM signals to them? Have you set the pins to be outputs in the setup()?
Can you write code that keeps them on so you can see if they are as bright?
Can you post what code you have?
Sorry I did briefly mention that I had coding in my very first post but I guess I did not explain it clearly. Ok so the idea is that I have a potentiometer attached to my Arduino which has a value that ranges from 0-1023 and the value that it is on determines whether a red, yellow or green LED is lit. So the code is needed to tell the LED's to light up when the potentiometer is at different values. So far I have only written the code up to where the red LED is lit if the potentiometer is at a value of 160 or less. Below is my code.
int gage = 3;
int redLED = 5;
int yellowLED = 6;
int greenLED = 7;