PWM signals are essential part where digital meets analog. PWM can be used to control lights, motors, sound. Simply speaking this is a way of encoding analog signals with width of digital pulses. All modern microcontrollers have feature to generate PWM signals. Following tutorial explains how to generate PWM signals onATmega168A microcontroller.
For easier understanding tutorial provides code examples on controlling RGB LED with PWM. This way mixing and dimming colors with three channel of PWM generation. This wouldn’t be possible without timers. So in order to generate 3 PWM signals there are at least two microcontroller timers needed. Example program goes through all color hues so there is a Hue, Saturation, Brightness color model used which then is converted in to RGB values and scaled down to values that are converted in to PWM.