What PWM Actually Does
Fast on/off pulses that act like a dimmer.
What PWM Actually Does is a free Arduino & IoT Academy lesson on CoddyKit — lesson 1 of 4. You can read the complete lesson below for free — then practise it hands-on in the browser with a built-in code editor and a 24/7 AI tutor. It is part of the Arduino & IoT Academy learning path, one of 4 lessons in the course, and your progress syncs across the web and the CoddyKit app.
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. 🎉
Frequently asked questions
Is the “What PWM Actually Does” lesson free?
Yes — the full text of “What PWM Actually Does” is free to read here on the web, and the Arduino & IoT Academy course includes 4 lessons in total. To practise it interactively (a built-in code editor and a 24/7 AI tutor) and unlock the rest of the Arduino & IoT Academy course, upgrade to CoddyKit PRO.
What will I learn in “What PWM Actually Does”?
Fast on/off pulses that act like a dimmer. You practise Arduino & IoT Academy with hands-on code you run directly in the browser, and a 24/7 AI tutor answers your questions as you work through the lesson.
Do I need any experience to start Arduino & IoT Academy?
No prior experience is required. Arduino & IoT Academy on CoddyKit is structured for beginners through advanced learners; this is — lesson 1 of 4, so you can start here or from the beginning and move at your own pace.
How long does the “What PWM Actually Does” lesson take?
Most CoddyKit lessons take about 5–10 minutes. Each one is bite-sized and interactive, so you make steady progress and pick up exactly where you left off across the web and the app.
Can I write and run code in this Arduino & IoT Academy lesson?
Yes. Every Arduino & IoT Academy lesson includes a built-in code editor, so you write and run real code right in your browser and get instant AI feedback — no local setup required.
All lessons in this course
- What PWM Actually Does
- analogWrite 0–255
- Fade an LED Up and Down
- Knob Controls LED Brightness