RGB LED
We can get LEDs in a variety of colors these days, but what about an LED that can change color? We all know that a combination of Red, Green, and Blue (RGB) can give us any color. Using the Arduino PWM functionality, we will see how we can obtain 16 million color combinations with an RGB LED.
RGB LED stands for Red Green Blue LED. Inside such an LED we can find one red, one green, and one blue LED, mounted together.
Getting ready
The following are the ingredients needed for this recipe:
- An Arduino board connected to the computer via USB
- A breadboard and jumper wires
- An RGB LED
- Three equal resistors between 220–1,000 ohm
How to do it…
Follow these steps in order to connect an RGB LED to an Arduino board:
- Mount the RGB LED on the breadboard.
- We need to identify which pin represents which color and which pin is the common one. The following graphic explains just that:
- Connect 5V to the common anode (+) of the RGB LED. This is the longest of the four pins.
- Connect each smaller cathode...