Let's start off by looking at the code for the RGB LED.
Code
RGB LED
We will start off by defining which pins on the Arduino are connected to the RGB pins on the LED:
#define REDPIN 11 #define BLUEPIN 10 #define GREENPIN 9
This code shows that the red pin is connected to the Arduino 11 PWM pin, the blue pin is connected to the Arduino 10 PWM pin and the green pin is connected to the Arduino 9 PWM pin. We are going to define an empty macro that will let the application code know whether we have a common anode or a common cathode RGB LED. The following code will do that:
#define COMMON_ANODE
If you are using a common cathode RGB LED, then comment or remove this line from your code. We will see how to use this when we look...