tri color led always on?1?

i have a tricolor led connected to my arduino. problem is when i connect the cathode leg to ground it doesn't work. when i connect it to 5v it's always on but does work. what am i doing wrong?

cryper

oh its from this site. but they dont have any data sheet links.

http://www.ledshoppe.com/Product/led/LE1011.htm

led has 4 pins. i've got the shortest pins connected to 3,5, 6 on the ardruino. and the longest pin connected to ground.

no resistors connected.

here's the code.

// // tri-color LED common cathode //

int ledpin1 = 3; // red LED connected to pin 2 via 1K ohm resistor int ledpin2 = 5; // blue LED connected to pin 3 via 1K ohm resistor int ledpin3 = 6; // green LED connected to pin 4 via 1K ohm resistor // LED cathode connected to ground void setup() { pinMode(ledpin1, OUTPUT); // nothing for setup pinMode(ledpin2, OUTPUT); pinMode(ledpin3, OUTPUT); }

void loop() {

//+++++++++ // turn on and off red LED //+++++++++

analogWrite(ledpin1, 255); // turn on the voltage on pin 2 to 5 volts delay(500); // wait for 500 milli seconds

analogWrite(ledpin1, 0); // turn off the voltage on pin 2 to 0 volts delay(500); // wait for 500 milli seconds

//+++++++++ // turn on and off blue LED //+++++++++

analogWrite(ledpin2, 255); // turn on the voltage on pin 3 to 5 volts delay(500); // wait for 500 milli seconds

analogWrite(ledpin2, 0); // turn off the voltage on pin 3 to 0 volts delay(500); // wait for 500 milli seconds

//+++++++++ // turn on and off green LED //+++++++++

analogWrite(ledpin3, 255); // turn on the voltage on pin 4 to 5 volts delay(500); // wait for 500 milli seconds

analogWrite(ledpin3, 0); // turn off the voltage on pin 4 to 0 volts delay(500); } // wait for 500 milli seconds

okay tried it. there are four legs on this led. 3 of them are colors and the longest one is the anode. also i was in such a rush to solve this problem i forgot to credit the proper person for the code i was using: (http://www.studiobricolage.org/files/tricolor_LED_each_color.pde)

i think the problem is better defined if i say the second i connect it to the arduino all 3 colors go off giving me a whitish light.

You could try deleting all the code in loop(). This way, the Arduino is not doing anything to the LED. Then, plug in the LED and resistors, and power up the Arduino.

Does the LED come on, anyway? If so, it's a wiring problem. If not, it's a coding problem.

Do you have a multi-meter with a DIODE testing setting? If so, try it out in a fairly dark room and you should be able to map out the pins.

Also, if you have a multimeter, you can put the test leads in place of the LED and verify if power is always on in those pins.

You could swap out that LED for three other LED's and verify this as well... could be a bad LED.

Maybe my brain isn't working right, but isn't the longest one normally the (+) leg... in which case you have 3 (-) leg's and 1 (+)...