Controlling common anode RGB LED with PWM - Can individual colors be done w/o transistors? I am using PWM (analogWrite) with a common anode LED. My previous experience is using a common cathode. My breadboard is as shown:







simulate this circuit &ndash; Schematic created using CircuitLab

This creates a semi-bright white (ugly red-green-blue mixture) like I expected. I am using only one PWM output (It is currently fading).

Now, what I ask is how can I use multiple PWM outputs to make different colors display without transistors? I was thinking that I could have 3 dedicated pins on the Arduino that switch from ground to floating extremely fast, but is there an easier way?
If not, a little explanation on how to do it with transistors (mostly just a small wiring diagram) would be great. Cheers!
As long as each LED in the array uses 20mA or less you can do it directly with the Arduino:







simulate this circuit &ndash; Schematic created using CircuitLab

Note that the blue LED will have a higher forward voltage than the red and green ones, hence the lower resistor.

Also note that the PWM will be inverted. Writing 255 to a channel will switch that LED off, while writing 0 will give it full brightness.