RGB LED setup?

Hi,
Silly question, but I can't find what I'm looking for.
Can anyone direct me to how you setup an RGB led with 4 leads?
Also any sample code would be much appreciated.

Thanks :wink:

The long leg is common. Connect it to a resistor connected to ground. Connect the other 3 legs to output pins or other voltage sources. Set the pin high to make the light come on. One pin will turn the red light on, one will turn the green one on, and one will turn the blue light on.

There seem to be some inconsistency in which leg (all 4 legs are different lengths) length corresponds to which color, so experimenting is the best way to determine which leg is which color.

The long leg is common.

Probably true.

Connect it to a resistor connected to ground.

Depends whether you bought common anode or common cathode.
Either way, you should have one resistor per colour, because Vf will be different for each colour.

The leds I have are Common Anode. Anyone have a code example?

You should be able to modify the blink example. The tri-color LED is just 3 LEDs in one physical case.