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 (or large breadboard). The circuit will look as shown in the following diagram:

Circuit diagram for the RGB LED module ...

Get Raspberry Pi 3 Cookbook for Python Programmers - Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.