LED Choice & Wiring
The RGB LED I had was a common cathode, so I tied the cathode to ground and the red, green, and blue wires of the LED to three of the PWM outputs. I imagine if you were to use a common anode RGB LED, you would still tie the three color-wires to PWMs, but the anode would be tied to +5V and a low PWM value would be brighter than a high PWM value on the common anode LED.
I had to take care to choose resistors that respected the LEDs' current limits. For the red wire, it was 50mA, and for the green and blue, 30mA. The circuit below did well for me, though I may have used resistors slightly higher than those depicted. I certainly wouldn't go with lower resistance.
|Figure 1: Wiring up a common cathode RGB LED|
Example Code & triColorLEDs Library
If you want to see the library in use, check out this short video below:
The best way to find out, though, is to download the triColorLEDs Library for yourself. The example that comes with it is actually different than the video above. Once you download the zip file, extract it to C:\Program Files\Arduino\arduino-1.0.1\libraries and use away.
Well, several weeks later after I started this post (and saved it as a draft), I started reading up on different types (byte vs. int vs. long), and I finally cleared up a little of the fuzziness my Mechanical Engineer brain encountered with these different types. In the future, I'll be condensing the library a little bit so it takes up less space. When that happens, I'll let you know.