RGB led question

maybe its sound stupid but i dont know how to connect a 4 pins rgb led to my arduino and generate colors, when i try i only get the red color.. thx for the help

One pin will be a "common cathode" or a "common anode" (and the packaging should tell you that).

Three other pins are for Red, Green and Blue. You will need three resistors, e.g., 220 ohm or thereabouts.

My photo shows a typical "common anode" package type, but the same idea works for "common cathode" types. It's just a matter of what you write to the output pins, and where the common wire goes, +V or GND.

For color blending/mixing you'll need to choose digital outs with PWM, often refered to as 'analog out'. (pins 3,5,6,9,10,11 are PWM, 3,5,6 are used in the photo above.)

Thanks for the help guys ! :smiley:

Also because the leds are of different efficiencies you can even them out by adjusting the resistors to give white light when all are powered 'full on'

You will find some code to drive an RGB LED, via the PWM output pins, here: http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1230560883

Also in that thread, there's a link to my photo of the setup in operation.