How to Control an RGB LED With an Arduino
by DIYmasters in Circuits > Arduino
4928 Views, 16 Favorites, 0 Comments
How to Control an RGB LED With an Arduino
In this Instructable, I'll be showing you how to control an RGB LED with an Arduino.
To complete this project, you'll need:
1x Arduino (I'm using the Arduino Uno R3)
1x RGB LED
3x 150-220 ohm resistors
4x Jumper Wires
1x Breadboard
1x Computer with Arduino IDE installed.
So lets get working...
Connect the LED to the Breadboard.
To begin with, you're going to need to connect your RGB LED any where on the breadboard. Just make sure that all four pins are available.
Connect the Ground Wire
Next, we're going to connect the ground wire to the LED. If you're not sure what pin the ground is, pull the LED put again and find the longest pin; it is the ground pin. See the diagram above.
Add the Resistors.
Now plug three 150-220 ohm resistors into the three remaining pins.
Connect the Jumper Wires
Now for the fun part. Connect three jumper wires to the red, green, and blue pins of the LED. I used jumper wires of the same color as the pins I was connecting them to.
If you're confused, pin 1 on the LED is blue, pin 2 is ground, pin 3 is green, and pin 4 is red.
Connecting the Wires to Your Arduino
Finally, you're going to need to connect all the wires to the Arduino's corresponding pins. The ground wire from the led connects to the GND pin on the Arduino, and the colored pins connect to pins 9,10, and 11 on the Arduino. It should look like the diagram above.
Check It to Make Sure...
Plug It In!
Now, plug the arduino into the computer's USB port.
Code
Open the Arduino IDE software that I'm assuming you've downloaded an installed already. You'll have to download the code from the button below. (sorry, the text editor kept squishing all the code into a paragraph. :-0)
Downloads
Yay!!!
If you did everything right, the led should now be fading through all the colors!
Enjoy!