How to wire Color Mixing Lamp with common anode RGB LEDs


I`m starting with my first Arduino projects here and I have a question. In project number 4 from the Projects Book all the explanation if for common cathode LEDs. However I have a common anode LED. I wired the anode of the LED with the 5V pin on my board and then G, B and R to Digital Pins number 9, 10 and 11 in series with 220 ohm resistors. The photoresists and the rest of the wiring was made as described in the projects book. My question is, as digital pins 9, 10 and 11 are outputs, and the anode is connected to 5V, where is my connection to ground? Is there anything that needs to be changed in the code?

Thank you very much in advance to you all!

Greetings from Argentina!


In that case the output pins are your ground. When you write them LOW, your lights will come on. If you use analogWrite, then lower values will make it brighter.

If you write it HIGH then you've got 5V on both ends of the LED so it goes off.

You are now in what is called an active low configuration.

Got it!!!
Thank you so much!!!!