Quoted from wxforecaster:
In otherwords, if you have a super blue LED with a forward voltage of 3.2V and apply 12V to it, bad things are going to happen.
Not necessarily. The short answer is that it's just not that simple. We're used to the experiment where we take an incandescent bulb and we alter the voltage and the light bulb changes brightness.
I know how the math all works but I'm still working on knowing enough about this to teach it. The LED is rated with a forward voltage of 3.3v. Any excess voltage rolls right on through. Resistors don't resist voltage, they resist current. If you had no resistor on the circuit and you fed it 5v, then 1.7v (5 - 3.3) would flow on through and with 0 resistance you would be forcing 1.7 amps through an LED that has a max rating of 30ma per the data sheet. (https://www.sparkfun.com/datasheets/Components/YSL-R542B5C-A11.pdf)
What you need to do is to put a resistor in series with the LED that will limit the current to an acceptable level for the LED. 20ma is really common for a lot of LEDs as the highest brightness with the longest life.
To get the circuit limited to 20ma you need to do this math:
(Source Voltage - Forward voltage) / .02 = Resistor Rating in Ohms.
5v - 3.3v / .02 = 85 ohm resistor.
1.7v * .02amps = .034 watts. So you could get away with a resistor rated at 1/8 watt.
I had a project that required an LED to go on when a 48v circuit was live. The LED had a forward voltage of 2.2v and of course an ideal current of 20ma.
48 - 2.2 / .02 = 2290 ohms (a 2.2k resistor was close enough).
However, 45.8v * .02 amps = .916 watts. So I needed a resistor rated at 1 watt in order to dissipate the heat.
The Blue LED shows a max current of 30ma. So you could squeeze a little more brightness out of it but the lifespan would diminish. Or you could get less brightness by allowing only 10ma through the LED.
It's just not practical to alter the resistance dynamically. You would need a crazy potentiometer that wasn't linear and had a weird lower range.
Using PWM is the preferred way because you're keeping the LED's balanced electronically but even PWM isn't completely linear where brightness is concerned. There are a lot of arduino threads on PWM curves for achieving an affect that is as close to linear as possible.