An RGB LED has 4 pins, one for each color (Red, Green, Blue) and a common cathode. It has three different color-emitting diodes that can be combined to create all sorts of color! Any color is possible depending on how bright each diode is.
In this tutorial you will learn how to use an RGB LED with Arduino and create unique color combinations.
What you will need – Hardware
For this tutorial you will need:
* 1 x Arduino uno board * 1 x Breadboard * 1 x 4 pin RGB LED * 3 x 330Ohm resistors
As an alternative you may use ready-to-use modules:
The connections are pretty easy, see the image above with breadboard circuit schematic.
We will use code from SparkFun Inventor’s Kit – SIK Guide, Example sketch 03. This is the best sketch to learn how an RGB LED works. The code is pretty self-explanatory, and the comments do a better job than me explaining how it works.
Download the code from here and open it with Arduino IDE. >>>> LINK <<<<