Che cosa fa davvero il PWM
Impulsi rapidi acceso/spento che funzionano come un dimmer
Che cosa fa davvero il PWM è una lezione Arduino & IoT Academy gratuita su CoddyKit. Questa è la lezione 1 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.
A Pin That Only Knows On or Off
A digital pin can only output full voltage or none at all. So how do you get a dim LED instead of just bright or dark? 💡
The Trick: Switch Very Fast
The answer is PWM: turn the pin on and off so quickly that your eye blends the flickers into one steady, in-between brightness.
PWM Stands For This
PWM means Pulse Width Modulation. You keep flipping the pin, and you change how wide each on-pulse is to control the average power.
Meet the Duty Cycle
The duty cycle is the percent of each cycle the pin stays on. 50% on means roughly half power and a half-bright LED.
More On-Time, More Power
A wider pulse means more on-time, so the LED looks brighter or a motor spins faster. Narrow pulses give you dim and slow.
It Is Still Digital
PWM never outputs a true middle voltage. The pin is always fully HIGH or fully LOW, just switching fast enough to feel smooth.
Your Eyes Do the Blending
The LED really does flicker, but the switching is so fast that persistence of vision makes it look like one constant level.
Frequency Keeps It Smooth
The frequency is how many on-off cycles happen each second. Arduino runs PWM around 490 Hz, fast enough to hide the flicker.
Only Some Pins Can Do It
Not every pin supports PWM. On an Uno, look for pins marked with a tilde symbol next to numbers like 3, 5, 6, 9, 10, and 11.
Where You Will Use It
PWM powers real effects: dimming an LED, fading lights, controlling motor speed, and even shaping simple tones from a buzzer. 🔊
One Command Sets It Up
In code you do not toggle the pin yourself. One built-in analogWrite call sets the duty cycle and the chip pulses for you.
analogWrite(9, 128); // ~50% duty on a PWM pinQuick Check
Let's lock in what PWM really controls.
Recap: PWM in a Nutshell
PWM fakes analog output by pulsing a digital pin fast. The duty cycle sets the power, and your eyes blend it into smooth brightness. 🎉
Domande Frequenti
La lezione «Che cosa fa davvero il PWM» è gratuita?
Sì — il testo completo di «Che cosa fa davvero il PWM» è 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 «Che cosa fa davvero il PWM»?
Impulsi rapidi acceso/spento che funzionano come un dimmer 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 1 di 4.
Quanto tempo richiede la lezione «Che cosa fa davvero il PWM»?
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
- Che cosa fa davvero il PWM
- analogWrite 0–255
- Aumentare e ridurre gradualmente la luminosità di un LED
- La manopola controlla la luminosità del LED