So. 5/.025 = 250.
(dhenry) Ohm's law applies to just linear devices. The above calculation reflects your complete lack of understanding about Ohm's law.
It still can be used here, just not the way you did - the resulting current would be considerably less what what you your calculation suggested.
In this case... Even if you take into account forward voltage drop of a typical 5 mm LED, you still end up with 220 ohms (Or 180 ohms if you went the other way in standard values). If you do *not* understand how Ohms law applies to control the amount of current in a simple 5V LED circuit, those who take your advise should do so with *much* suspicion now.
Ohms Law calculation is about the resistor... which is linear... and used to control the current in that section of the circuit... which includes and LED, which for all practical purposes is a unidirectional conductor.
It is YOU who do not understand. That is clear to me now.
Guys - please stop the flaming... I thought this forum was about helping people interested in using Arduinos in their different projects, not for flaming those who try to help!
@pwillard - I think You too have a reason to review the link posted by Grumpy_Mike. Btw, Your calculation is wrong unless You have different laws of mathematics than the rest of us... 5/0.025 is not equal to 250 - it is equal to 200... And to be honest, if You use a 220 ohm resistor You will end up with a dimly lit led...
@Code - Do not drive the leds directly from an Arduino pin without any current limitation, You may/will end up letting the magic smoke out. Check the specs for Your leds (voltage drop and current needed) and read the link posted by Grumpy_Mike. It is imho
a good guide to the correct way to light a standard low power
led. Good luck with Your project!
Basically not true about the 'dimly lit led' with a 220 ohm resistor. We have had reports (and I've recreated it on my board) of being able to see a led 'dimly lit' just having the internal pull-up enabled and the pin still in input mode! And that represents about a 40k ohm series current limiting resistor wired to the grounded LED! Today's high efficiency leds will light at a very wide range of currents, there is no need to run them at 20ma just because that is their recommended maximum continuous current rating. The standard arduino boards use a 1K series resistor for the on-board pin 13 led and no one usually complains about the blink sketch being too dim.
So bottom line simple low power leds do need series current limiting resistors to protect the led and the output pin, but anything from 200 to 1K ohms will do the job safely and effectively.