How to Use an RGB LED - Arduino Tutorial

by codebender_cc in Circuits > Arduino

52756 Views, 316 Favorites, 0 Comments

How to Use an RGB LED - Arduino Tutorial

Χωρίς τίτλο.png
IMG_20150625_201856.jpg
IMG_20150625_201852.jpg
IMG_20150625_201847.jpg

An RGB LED has 4 pins, one for each color (Red, Green, Blue) and a common cathode. It has tree 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.

Watch the following video:

In this tutorial you will learn how to use an RGB LED with Arduino and create unique color combinations.

So, let's get started!

What You Will Need

arduino uno.jpg

For this tutorial you will need:

  • Arduino uno
  • Breadboard
  • RGB LED
  • 3x 330Ohm resistors

The Circuit

rgb.png
rgb.jpg

The connections are pretty easy, see the image above with the breadboard circuit schematic.

The Code

Here's the code, embedded using codebender!

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.

Try downloading the codebender plugin and clicking on the Run on Arduino button to program your Arduino board with this sketch. And that's it, you've programmed yourArduino with the RGB LED sketch!

Well Done!

IMG_20150625_201856.jpg

You have successfully completed one more Arduino "How to" tutorial and you learned how to use an RGB LED with Arduino.