LEDs
The friendliest component in electronics, and the one you will use most.
In 10 seconds
- • Long leg is positive and goes toward the pin.
- • Always add a resistor (220 Ω is a safe default).
- • Dark LED? It is probably in backwards.
An LED — light emitting diode — is a tiny lamp that turns electricity straight into light with almost no waste and almost no heat. It is the first component nearly every maker touches, and even experienced engineers still use LEDs constantly, because a light that says "yes, this part of my circuit is working" is worth a hundred lines of debugging.
LEDs have a direction
This is the single most important thing to remember. An LED is a one-way street: electricity can only flow through it in one direction. Look closely at a fresh LED and you will see one leg is longer than the other. The long leg is the positive side (anode) and connects toward your Arduino pin. The short leg is negative (cathode) and goes toward ground. There is also a tiny flat notch on the rim next to the short leg, useful once you have trimmed the legs.
Wire one backwards and nothing happens. Nothing breaks either — it simply sits there quietly. So if an LED refuses to light, the first thing every maker does, without even thinking, is turn it around.
Always add a resistor
An LED will greedily take as much current as you give it, and then it will die — sometimes with a small pop and a puff of smoke. A resistor sits in the path and limits the flow to a safe level. For a standard 5mm LED on a 5V Arduino, a 220Ω resistor is the everyday choice. Some people use 330Ω for a slightly dimmer, longer life. Either is fine.
It does not matter whether the resistor goes before or after the LED, because current is the same all the way around a loop. Put it wherever makes your breadboard tidier.
Colours are not just paint
Different colours are made from different materials, and each needs a slightly different voltage to light up: red about 1.8V, green and yellow around 2.1V, and blue or white closer to 3.2V. That is why, if you wire a red and a blue LED side by side with the same resistor, the blue one often looks dimmer. Give the blue one a smaller resistor to even them out.
Making them do more than blink
- Fade — use
analogWrite()on a ~ pin to change brightness smoothly. - Mix colours — an RGB LED is three LEDs in one package; drive each with PWM and you can make any colour you like.
- Go big — addressable strips like the WS2812 let you control hundreds of LEDs individually with a single data wire.
Start with the humble single LED though. Every project on this site, from a traffic light to a smart home, is built on top of the same skill: switch a pin, light a lamp, make something happen in the real world.
Quick quiz: LEDs
3 questions to check it stuck.
Next lesson
🔘 Buttons
Ready to try it for real?
Reading is good. Wiring is better. Pick a project and put this to work.
Explore projects