In this chapter, we will look at how to use RGB LEDs and a WS2812 40 RGB LED Pixel Arduino shield. Let's start off by learning about the RGB LED.
A multicolor or RGB LED isn't really a single LED that can change color, it is actually three LEDs. An RGB LED contains three LEDs, which are red, green, and blue in color. The color that the LED produces is a combination of the colors produced by these three LEDs.
There are two types of RGB LEDs. These are the common anode and the common cathode LED. In a common cathode LED, the three LEDs share a common ground source, and in a common anode RGB LED, the three LEDs share a common power source.
The RGB LED has four pins, one for each color and the fourth one for the common cathode or anode connection. The following diagram shows the pins for both the common cathode and common anode RGB LED:
To produce the various...