Chapter 10. Pulse-Width Modulation

So far, everything’s been either on or off in our AVR world—strictly digital. LEDs have been either on or off. Speaker cones have been either pulled fully back or pushed fully forward. Electrons have been pushed this way or that through antennas without particular finesse. On and off is fun, but sometimes you want an LED to fade instead of blink, or a motor to run at half speed instead of being always on or off. Or you’d like to make some audio waveforms other than just the square wave, and you’d like them to have volume control.

To do that, we’ll need to figure out a way to make intermediate voltages from the AVR’s logical high and low, and one of the most common ways of doing so ...

Get Make: AVR Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.