a. light up an LED
b. light up a RGB LED and use it's three colors
c. get information about what's happening in your arduino through the serial monitor
Of course, lighting up an LED is easy. There's the blink tutorial on how to blink an LED, but I modified it a little bit and jumped to lighting up your RBG LED and get the status of the Arduino through the serial monitor. Well, the arduino won't really tell you anything, but we'll tell it what to tell to us about what we told it to do. Basically, tell us what is the current color of the RBG LED.
This should help you:
a. be able to create status messages on your arduino to be view on the serial monitor so that you know what's happening
b. help you understand why sometimes we need to know what's happening
In this instructable, all you need is available in your Arduino Starter kit from Sparkfun.com. But here's a list:
1. RBG LED
2. 4 wires, preferably 1 black, 1 red, 1 blue, and 1 green
3. a 10kOhm resistor (optional)
4. an Arduino board, the one I used is the Arduino Duemilanove board with ATMEGA328
5. breadboard, or similar
Step 1: Wiring
I've added a 10kOhm resistor so that I can dim the LED a little bit because without that, the LED shines really bright. I mean, REALLY bright. Although, if you choose not to put a resistor, that's fine. It will still work.
Step 2: Code and Serial Monitor
The code is attached, but you can copy paste it from this page www.zeighy.net/site-files/content/public/RBGSERIAL.html
RGB_Serial.pde1 KBStep 3: Final Remarks
Where do you go from here:
- you can now use other sensors and you can display status using the serial monitor. Check the reference on the Arduino website on how to display values form sensors
- build your own circuit and get status messages from the arduino so that you know what's happening and to know of something is going wrong.
- you might probably want to try out other methods you can use information you get from the serial connection.
Here's a sample run of mine:





































Visit Our Store »
Go Pro Today »




I'll have to go grab all the bits and bobs to put it together, i'll post in the next week or so (or when i can find time) and let you know how i go!
The thought is using this value to alter a colour scheme on a flash based (only idea at the moment) frontend, and alter the value from the frontend to reflect on the LED's... I'm kinda hobbling together pieces of tutorials from left right and centre, so i'll keep ya posted mate!
Thanks again for your help, and prompt reply!
wish you all the best! good luck!
http://tv.adobe.com/watch/adc-presents/physical-computing-with-arduino-rgb-led/
Have a browse through the list of episodes, there's also a bit about wireless control. I haven't tried them yet but the clip seems pretty well thought through and concise, may be handy!
I am using a analog control to adjust the RGB values and would like to find a way to reflect that value in an application?
At a guess it might have something to do with trying to reflect the PW modulations, turning it from a percentage value back to a range from 255?
I haven't had much of a dabble with all this yet, just browsing about and doing some learning, so if I'm off track please correct me! Any thoughts would be appreciated.
--- code start ---
int RPin = 11;
int GPin = 10;
int BPin = 9;
int activePin;
int PWMvalue;
double PWMpercent;
void setup() {
}
void loop() {
activePin = RPin;
PWMpercent = 0.50;
getPWM();
analogWrite(activePin, PWMvalue);
activePin = GPin;
PWMpercent = 0.50;
getPWM();
analogWrite(activePin, PWMvalue);
}
void getPWM(){
PWMvalue = PWMpercent * 255; // PWMpercent in decimal value e.g. .25 for 25 percent or 1.00 for 100 percent
}
--- code end --
make sure you add resistors to avoid burning your LED...
my sample basically lights up the red and green at 50% of 255