PWM

Using the PWM peripheral of common microcontrollers.

PWM, or Pulse Width Modulation, is a deceptively simple but very powerful technique for controlling various things in the real world. Perhaps the most well known application is dimming LEDs, but PWM can also be used to control servo motors and producing crude (square wave) tones on speakers.


LED: blink

Get a LED to blink using the PWM peripheral.

LED: fade

Fade a LED using the PWM peripheral.

LED: fade multiple

Control multiple channels from a single PWM peripheral by making use of channels.

Servo: intro

Control a servo motor directly using PWM

Servo: using a driver

Control a servo motor using the servo driver to simplify things.

Servo: multiple servos

Control multiple servos at once

Last modified May 1, 2025: Add PWM tour (af9cc3a)