Collegare in sicurezza un LED esterno
Aggiungere una resistenza e far lampeggiare un LED esterno alla scheda
Collegare in sicurezza un LED esterno è una lezione Arduino & IoT Academy gratuita su CoddyKit. Questa è la lezione 4 di 4. Puoi leggere la lezione completa qui gratuitamente — poi esercitati direttamente nel browser con un editor di codice integrato e un tutor IA disponibile 24/7. Fa parte del percorso di apprendimento Arduino & IoT Academy, e i tuoi progressi si sincronizzano tra il web e l'app CoddyKit. Il corso Arduino & IoT Academy include 4 lezioni in totale.
Parti di questa lezione non sono ancora state tradotte e vengono mostrate in inglese.
Beyond the Onboard LED
The onboard light is handy, but real projects need their own LEDs. Wiring one up takes just a few parts and a little care. 🔧
LEDs Have a Direction
An LED only lets current flow one way. Its long leg is the positive anode, and the short leg is the negative cathode. Orientation matters.
Long Leg to the Pin
Connect the long leg toward your Arduino pin, the source of voltage. The short leg heads toward ground, completing the path for current.
Why You Need a Resistor
A raw pin can shove too much current through an LED and burn it out. A resistor limits that flow so the LED stays bright but safe.
Pick the Right Value
For a 5V pin, a resistor around 220 ohms is a safe, common choice. It gives a clear glow without stressing the LED or the pin.
It Goes In Series
Place the resistor in line with the LED, not beside it. Pin to resistor to LED to ground means every electron passes through the resistor.
Either Side Works
A resistor has no direction, so it can sit before or after the LED. What matters is that it stays in the same series path with it.
Find the Ground Pin
Your Arduino has a pin marked GND. The LED circuit must return there, because current needs a complete loop back to ground to flow.
Reuse Your Blink Code
The wiring changed, not the code. Point pinMode and digitalWrite at the pin you wired, and your familiar blink sketch lights the new LED.
const int ledPin = 9;
pinMode(ledPin, OUTPUT);When It Stays Dark
No light usually means a backwards LED or a loose wire. Flip the LED and recheck each connection to ground before blaming the code.
Never Skip the Resistor
Tempted to wire an LED straight to a pin? Do not. Without a resistor you risk frying the LED and even damaging the Arduino pin.
Quick Check
Why does an external LED need a resistor in series?
Recap
You wired an external LED with the long leg to a pin and a resistor guarding the path to ground. You can now build LEDs into any project. 🎉
Domande Frequenti
La lezione «Collegare in sicurezza un LED esterno» è gratuita?
Sì — il testo completo di «Collegare in sicurezza un LED esterno» è gratuito qui sul web. Per esercitarvi in modo interattivo (un editor di codice integrato e un tutor IA 24/7) e sbloccare il resto del corso Arduino & IoT Academy, passa a CoddyKit PRO. Il corso Arduino & IoT Academy include 4 lezioni in totale.
Cosa imparerò in «Collegare in sicurezza un LED esterno»?
Aggiungere una resistenza e far lampeggiare un LED esterno alla scheda Eserciti Arduino & IoT Academy con codice pratico che esegui direttamente nel browser, e un tutor IA 24/7 risponde alle tue domande mentre lavori sulla lezione.
Ho bisogno di esperienza per iniziare Arduino & IoT Academy?
Non è richiesta alcuna esperienza precedente. Arduino & IoT Academy su CoddyKit è strutturato per principianti e studenti avanzati, quindi puoi iniziare da qui o dall'inizio e procedere al tuo ritmo. Questa è la lezione 4 di 4.
Quanto tempo richiede la lezione «Collegare in sicurezza un LED esterno»?
La maggior parte delle lezioni CoddyKit richiede circa 5–10 minuti. Ogni lezione è breve e interattiva, quindi fai progressi costanti e riprendi esattamente da dove hai lasciato su web e app.
Posso scrivere ed eseguire codice in questa lezione Arduino & IoT Academy?
Sì. Ogni lezione Arduino & IoT Academy include un editor di codice integrato, quindi scrivi ed esegui codice reale direttamente nel tuo browser e ricevi feedback istantaneo dall'IA — nessuna configurazione locale necessaria.
Tutte le lezioni di questo corso
- pinMode e OUTPUT
- digitalWrite HIGH e LOW
- delay() e temporizzazione del lampeggio
- Collegare in sicurezza un LED esterno