ARDUINO
PROJECT – RGB LED
PROJECT
DESCRIPTION
You will connect your Arduino to an RGB LED.
LESSONS
You should look up the RGB LED page in the Electronics unit if you
haven’t.
WARNING: The longest
pin on an RGB LED is a common pin that connects to all three individual
LEDs. It needs to be connected to a
resistor.
STEPS
1-Determine if your RGB LED is a Common Anode (+) or Common Cathode (-)
LED. You can
To test if it is Common Anode,
connect the longest pin to a resistor and the resistor to 5V. Then connect any other pin to Ground to see
if one of the LEDs goes on.
To test if it is Common Cathode,
connect the longest pin to a resistor and the resistor to GROUND. Then connect any other pin to 5V to see if
one of the LEDs goes on.
If neither of the above tests
work, see your teacher.
2-Connect your LED to your Arduino.
No matter the result from Step 1,
the connection for the longest pin stays as is.
You need to disconnect any of the other LED pins that you might have
connected for testing purposes.
Each pin should now be connected
to a digital pin on the Arduino. I
suggest red to pin 3, green to pin 5 and blue to pin 6 since those pins are PWM
pins (they have a ~ symbol on them).
Note: If your LED is Common
Anode, your pins actually have to output ZERO to turn on the LEDs. If your LED is Common Cathode, your pins need
to output ONE.
3-Write the following program:
4-Test your program. Your LED
should show red.
5-You should now explore with different values for all three pins. Note that the colour
of your LED will not exactly match true RGB colours (in part because the red
LED should have a different resistor than the green and blue ones as it is
rated for a lower voltage).
6-Make sure you can create a few common colours such as pink, yellow,
orange, lime green, purple, light blue, teal, and so on…
PROJECT
EXPECTATIONS
Mr. Campeau will ask you to show him a specific colour
on the LED and you must do so within 1 minute.