RGB LED now working

Hi, :D

I am trying to light up a RGB led with the arduino. I have used all the coding that I can find and I have, of course, checked that everything is wired properly (cathode-gnd, red-9, green-11, blue-10, "all digital") and nothing works.

It seems to be a problem with the RGB led itself, as i have tested all the coding with normal leds and they light up. So I tried three different RGB leds, and none of them will light up....

Any recommendations will be great!!

thanks :-/

sorry title should be "NOT" not "now" :)...ooops

Circuit? Code?

You don't say anything about series resistors so if you don't have any, if you want, say, 20 mA drive current, you need a 150 ohm for the red one and about 100 ohms for the other two.

That's assuming it is a common cathode array, also. That's also assuming you didn't destroy the LEDs by not current limiting. It's unlikely that you did, you would have noticed the bright flash.

Having said all that, it sounds like a wiring problem. Double check against the data sheet. The cathode is normally the longest lead.

emljane - aaa...didn't use any resistors for the green and blue, so that is probably it. even though i had wired up the same as jacek spiewla has here http://jacekspiewla.com/blog/arduino-hacking-rgb-led-and-force-pressure-sensor/. i'll try it tomorrow and let you know if it works. :) thank you!!

awol - i am using three different codes; 1. http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1230560883 2. the arduino pwm/fading example 3. and jacek spiewla code (from the link above)

Ok, :-/ So it was not a problem with the coding, wiring or resistors. but it appears that the rgb leds that they have in this department are not the usual ones.

what happens is, the colours come from pin2 (the long leg which you would think is the cathode) and depending on where the ground is plugged into is what colour is emitted from the led. here's the tricky bit....you obviously can't have three pins running to ground at once so you need a switch, which is annoying for what I want to do.

which leaves me with these question: - have i done something SUPER wrong?? - how many variations of rgb leds can you get? - what is the one that I have called( so i can look at the data sheet) - and why would someone want to use this one? it's as useful as using a normal led

think i'll just buy the normal ones from sparkfun :P

Okay, no problem. You have a common anode RGB LED.

Connect Pin 2 to 5V. The rest of the pins and their series resistors can go where you had them before. The difference will be in your sketch where now writing a LOW to the output pin will turn the LED on instead of a HIGH like if it had truly been a common cathode LED.

The big difference will come when you use PWM. Now you will need to pass (value ^ 255) to the analogWrite(pin, value) function.

YAAAAAY!!!!!!!!!

thank you so so so much!!!

one more question...why would some use a anode rgb led? (sorry if it is silly but i know hardly anything about electronics)

Yay! You're welcome.

It's really a matter of what kind of drivers you have. With a common anode LED you can use NPN bipolar transistors or N-channel MOS devices to drive the separate cathodes. Since these effectively invert the signal used to activate them, you would be back to the same HIGH to turn the LEDs on that you had in your original sketch.

If you had LEDs that could tolerate higher current than the Arduino could supply, you might want to use a common anode LED because you already had a lot of NPNs or N-channel devices.