How to Use an RGB LED - Arduino Tutorial


22,311

312

10

Arduino Tutorials by Codebender.cc Team

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!

Teacher Notes

Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.

Step 1: What You Will Need

For this tutorial you will need:

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

Step 2: The Circuit

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

Step 3: 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!

Step 4: Well Done!

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

1 Person Made This Project!

Recommendations

  • Made with Math Contest

    Made with Math Contest
  • Multi-Discipline Contest

    Multi-Discipline Contest
  • Robotics Contest

    Robotics Contest

10 Discussions

0
None
WhittlinThom

3 years ago

Hi, I might be wrong but your pictorial diagram looks to me like it will only lite the green light on the blue wire. Am I mistaken?

1 reply
0
None
WallyWorld23kavish laxkar

Reply 3 years ago

Instead of attaching it to the negative(-) you need to attach them to the positive(+) 5v or the light won't turn on. This is what I've found out

0
None
JRV31

4 years ago on Introduction

Make sure you use common cathode LEDs with this instructable. Adafruit sells common anode RGB LEDs, Sparkfun sells both.

2 replies
0
None
zwalker3JRV31

Reply 4 years ago on Introduction

how do i tell or know its a common cathode compaired to (what are the other comparisions)?

0
None
JRV31zwalker3

Reply 4 years ago on Introduction

They look the same, you need to read the datasheet or the part description before buying.

0
None

Hello, I am new in this channel I need help to manage more possible LED and independent. Could you help me?