Let's Make Robots!

Fading an LED with hardware

Hi guys,

I am trying to get an LED (attached to the i/o port of a microcontroller) to fade in and fade out without using PWM.  I hooked up a resistor and LED pair in parallel with a large-ish polarised capacitor, thinking that as the cap charged it would prevent some current getting to the LED, resulting in a fade up to full brightness.  When power was removed the cap would then slowly empty it's charge through the LED, resulting in a fade out.  It worked for the fade out but not the fade in; it simply went to full brightness when power was applied.