Help with common anode LED

I'm trying to wire up some common anode LEDs and I'm having a little trouble. If I wire one of the output pins to be HIGH and connect that to the LED and one of the cathodes to ground I can get it to light up in any of the three colours depending on which cathode I connect to ground but this isn't much help as I can't change the colour of the LED the pins then, but if I change the pin to be LOW connected to one of the cathodes and connect the anode to the 5v pin I can't get it to light up at all.

I'm really confused, do I have to initialise the 5v pin or something to get it to output? If not what could I be doing wrong?

Thanks

Arduino pins can sink current as well as source it. When a pin is LOW it's connected to ground.

PS: Don't forget your resistors.

Just a guess, you have a three color led, common anode.
You need to connect the common anode lead of the led to +5Volt.
Through a resistor (3) you connect the other 3 leads to output pins that can do PWM. The resistore (3) can be between 200 and 2000 ohms.
Then you can send pwm signals to the three pins to get different color patterns.

I think that's what I'm doing at the moment without any success, anode to 5v pin, cathode to resistor then one of the output pins set to LOW but for some reason this doesn't seem to work...

Ok,

  1. what value resistors, how many?
  2. What happens when you connect the resistor to a pin set low?
  3. Did you read the voltage with a volt meter?
  4. What if you connect the resistor to a ground pin?
    5.Your anode is connected to what 5volt? you can use the 5volt from the arduino if your resistors is not really low values.

fryingpancat:
I think that's what I'm doing at the moment without any success, anode to 5v pin, cathode to resistor then one of the output pins set to LOW but for some reason this doesn't seem to work...

What you think you are doing is right.
What you are actually doing is not what you think you are doing.
So give us a bit more information so we can spot the disconnect. How about a photo of your wiring?
It would also help to see your code. Have you set the pins to be outputs?

jackwp:
Ok,

  1. what value resistors, how many?
  2. What happens when you connect the resistor to a pin set low?
  3. Did you read the voltage with a volt meter?
  4. What if you connect the resistor to a ground pin?
    5.Your anode is connected to what 5volt? you can use the 5volt from the arduino if your resistors is not really low values.
  1. I'm using one 220 ohm resistor (just trying to get a single colour working right now, so only using one have one cathode wired up)
  2. A little confused by what you mean here (I may just be being slow)
  3. I haven't tried this yet, I will do when I get home and have a minute
  4. I shall also try this later
  5. The anode is connected to the 5volt from the arduino

Grumpy_Mike:

fryingpancat:
I think that's what I'm doing at the moment without any success, anode to 5v pin, cathode to resistor then one of the output pins set to LOW but for some reason this doesn't seem to work...

What you think you are doing is right.
What you are actually doing is not what you think you are doing.
So give us a bit more information so we can spot the disconnect. How about a photo of your wiring?
It would also help to see your code. Have you set the pins to be outputs?

I'll post a photo of my wiring when I get home and upload. I shall also paste in my code too.

I've no idea why but when I tried wiring it up again it seems to work, so I don't know what I was doing wrong last time. Thanks for your help though guys