USB color changer overview
Pulse-Width Modulation Figure
The easiest way to dim LEDs is to blink them and vary the ratio of on and off time. If the LED blinks fast enough, we perceive it as a solid light of lower intensity. This method of dimming is known as pulse-width modulation (PWM).The figure shows a single period in a pulse-width modulation cycle. At the start of the period, the signal is high (the LED is on) for the time defined as the duty cycle. When the duty cycle is finished, the signal goes low (the LED is off) for the remainder of the period. Adjusting the duty cycle varies the brightness of the LED. By extending this to red, green, and blue channels, we can mix a nearly infinite number of colors.