Posts

Showing posts from May 25, 2025

How to Fade an LED

Image
In this tutorial we're going to talk about fading an LED from On to Off and back again but I think it would be really useful to have two LED's to fade. This means a short detour into setting up LED's and most importantly current limiting resistors. Most modern microcontrollers are capable of supplying enough power to directly drive an LED, meaning you can connect an LED to an IO pin and directly turn it On/Off. There is a limit to how much power the pin can supply and also how much power the LED can take before one or the other will burn out. You should never connect an LED directly to a power source, you should always have a resistor in line with it to limit the maximum amount of current that can flow through it. To calculate the exact amount of current flowing through a circuit you need to know Ohms law .  Voltage = Current x Resistance .  We're using a 100 Ohm resistors in this circuit, so if it were connected to 3.3V output on the GPIO pin the current would be 3.3/...