Wiring pins with PWM capabilities
We want to control the output voltage to make it possible to fade in and fade out three LEDs of three different colors: red, green and blue. The lower the output voltage, the lower the brightness level for the LEDs. The higher the output voltage, the higher the brightness level for the LEDs. Thus, as the output voltage is nearer to 0V, the brightness for the LEDs is lower and when the output voltage is nearer the IOREF voltage, that is, 5V in our actual configuration, the brightness is higher for the LEDs. Specifically, we want to be able to set 256 brightness levels for each LED, from 0 to 255. In this case, we will use three LEDs but we will move to a single RGB LED capable of mixing the three colors in a single electronic component later in this chapter.
When we worked with GPIO pins configured as digital outputs, we could set an output voltage of 0V (low value) or the IOREF voltage, that is, 5V in our actual configuration (high value). Thus, we could...