7
Using Pulse-Width Modulation
When you need a digital output to simulate an analog signal, such as operating an LED at partial brightness, you can use pulse-width modulation (PWM) to adjust the amount of time between each high and low signal from a digital output pin. PWM can generate various effects, such as adjusting the brightness of an LED, controlling the speed of an electric motor, and creating sounds using tools that convert electricity into vibrations.
In this chapter, you will:
- • Learn how pulse-width modulation works and is generated by AVRs.
- • Use PWM with ATtiny85 and ATmega328P-PU microcontrollers.
- • Make varying tones of sound ...
Get AVR Workshop 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.