Multiplexed color LEDs
The next example in this chapter demonstrates that some seemingly simple hardware can produce some impressive results if controlled with software. For this, we will go back to using RGB LEDs. We will use five RGB LEDs that are wired so that we only need to use eight GPIO pins to control their red, green, and blue elements using a method called hardware multiplexing (see the Hardware multiplexing subsection in the There's more... section of this recipe).
Getting ready
You will need the RGB LED module shown in the following picture:
The RGB LED module from PiHardware.com
As you can see in the preceding photo, the RGB LED module from http://pihardware.com/Â comes with GPIO pins and a DuPont female-to-female cable for connecting it. Although there are two sets of pins labelled from 1 to 5, only one side needs to be connected.
Alternatively, you can recreate your own with the following circuit using five common cathode RGB LEDs, 3 x 470 ohm resistors, and a Vero prototype board...