You need to know the forward voltage drop of the LED, and the current rating. A typical red LED will have a forward voltage drop of ~1.4 VDC, which is essentially independent of current. Other colors have slightly higher voltage drops, with blue being the highest at ~3 VDC
Basically, you subtract the LED voltage drop from the supply voltage, and then use ohm's law to select a resistor that will drop the remainder of the voltage at the desired current. An example:
Powering a green LED with a voltage drop of 1.6 V and a current rating of 15 mA. Supply voltage 24 VDC.
24VDC (supply voltage) - 1.6 V (LED drop) = 22.4 V (drop across resistor)
Resistance = 22.4V / 0.015A = 1493 ohms
Closest standard value would 1.5K ohms.
Power dissipated in the resistor would be:
22.4V * 0.015A = .336 Watts
Next higher standard value would be 1/2 W
[This message has been edited by NJwirenut (edited 05-22-2004).]