Introduction: 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 Computer with Arduino IDE installed.
So lets get working...
Step 1: 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.
Step 2: 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.
Step 3: Add the Resistors.
Now plug three 150-220 ohm resistors into the three remaining pins.
Step 4: 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.
Step 5: 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.
Step 6: Check It to Make Sure...
Step 7: Plug It In!
Now, plug the arduino into the computer's USB port.
Step 8: 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)
Step 9: Yay!!!
If you did everything right, the led should now be fading through all the colors!