A while ago I wrote an electronics lesson post on how to use pulse width modulation to move a servo device.
However, servo control is not the only use for PWM.
There are a series of other ways in which PWM can be useful.
the first of which is persistence of vision.
persistence of vision is basically referring to an effect that can most closely be stated as the refresh rate of our eyes.
We all know that TV is a series of pictures that just blink incredibly fast, but due to persistence of vision we never see the "off" part where the picture changes.
This effect leads to a pretty cool thing that you can do with very fast on off light devices such as LEDs.
if you turn an LED on, it is a bright source of light.
if you turn an LED off, it shows no light.
if you turn an LED on, then off, then on then off repeatedly (with equally measures of on and off) then the LED will appear around half as bright as when it's constantly on.
(I mean on and off really fast, measured in milliseconds!!)
if you turn the light on for 1 millisecond, then off for 3 milliseconds and repeat the light will seem 1/4 as bright as the fully on LED, on for 3 milliseconds and off for 1 millisecond and the light seems 3/4 as bright.
This means, (with some clever work from the device turning the power on and off) than you can produce some really nice effects, such as variable LED lighting, or pulsing LED's that smoothly transition from dim to bright.
Another use is playing audio, yes making sound.
and on/off square wave will sound just like a buzzer. but if you add a capacitor, (which can store energy) your mostly on pulses now start to charge the capacitor and bring the wave cycle up, and then when you transition to mostly off cycles the capacitor discharges and your wave form falls.
Creating a smooth audio wave from a digitally stored PWM signal.
an example of this can be seen in this project: