Raspberry Pi LESSON 13: Set Color of RGB LED with Push Buttons

In this video lesson we show how you can use pushbuttons and PWM (Pulse Width Modulation) to mix colors and create any color you want in an RGB LED. We are using the most excellent Sunfounder Ultimate Raspberry Pi kit, which you can snag HERE.

You will need to start by connecting up the following circuit. You will find all the components you need in the Sunfounder kit.

Circuit Diagram for connecting an RGB LED to a Raspberry PI

You can click on the circuit diagram for a bigger view. In the video above, we explain in detail the coding but for your convenience, we include the finished code below: