An LED is a light-emitting diode, which is a diode that glows when it's conducting instead of just conducting like any other stupid boring diode.
When an LED is powered, its voltage settles down to a consistent value, just like any other diode. This is known as the forward bias voltage. For most LEDs in common use this is around 2 volts, but it could be anywhere from 1 to 4 volts.
The resistor is used to limit the current that flows through the LED, so that we don't burn up its tiny little wires. Most LEDs should be fed no more than 20mA. We'll assume the forward bias voltage is 2V, so 5V - 2V = 3V across the resistor. I usually use 330Ω resistors in this case, 3V / 330Ω = 9.1 mA, so we're at about half the recommended 20mA. This should be decently bright without overloading the lamps or the output drivers. For awesome brightness, 150Ω should give you about 20mA, but beware of low-voltage LEDs.
You can order these yellow resistor ICs (8-pack) that make changing the value really easy if you use them with a breadboard or socket. Make sure you get the DIP kind, not the common-terminal SIP type.
from http://forums.somethingawful.com/showthread.php?postid=297462130#post297462130
This article is ©2008 by the respective authors. Reproduction is prohibited without express permission from all contributors.