Book Image

Raspberry Pi cookbook for Python programmers

Book Image

Raspberry Pi cookbook for Python programmers

Overview of this book

Table of Contents (18 chapters)
Raspberry Pi Cookbook for Python Programmers
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Multiplexed color LEDs


The next example in this chapter demonstrates that some seemingly simple hardware can produce some impressive results if controlled with software. We return to using some RGB LEDs that are wired so that we only need to use eight GPIO pins to control the red, green, and blue elements of five RGB LEDs 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 as shown in the following image:

The RGB LED module from PiHardware.com

As you can see in the preceding image, the RGB LED module from PiHardware.com comes with GPIO pins and a Dupont female to female cable for connecting it. Although there are two sets of pins labelled 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 and 3x 470 ohm resistors and a Vero prototype board (or large breadboard). The circuit...