Whadda WPM307 RGB LED Module Arduino example code
This Arduino demo will fade the red, green and blue channels of the RGB LED module in
and out.
For more information about the Whadda WPM307 RGB LED Module, consult the manual,
available online at whadda.com
Example based on Arduino fade example:
This example code is in the public domain.
http://www.arduino.cc/en/Tutorial/Fade
*/
// define colors
#define RED 0
#define GREEN 1
#define BLUE 2
// define RGB LED Pins
int rgbLed[] = {10, 11, 9}; // Pin mapping of the Red, Green and Blue LED channels
void setup() {
// Set all of the pins of the RGB LED to OUTPUT
for(int i=0; i<3; i++) {
pinMode(rgbLed[i], OUTPUT);
}
}
void loop() {
// fade RED LED in from min to max in increments of 5 points:
for (int fadeValue = 0 ; fadeValue <= 255; fadeValue += 5) {
// sets the value (range from 0 to 255) of the RED LED:
analogWrite(rgbLed[RED], fadeValue);
// wait for 30 milliseconds to see the dimming effect
delay(30);
}
// fade RED LED out from max to min in increments of 5 points:
for (int fadeValue = 255 ; fadeValue >= 0; fadeValue -= 5) {
// sets the value (range from 0 to 255) of the RED LED:
analogWrite(rgbLed[RED], fadeValue);
// wait for 30 milliseconds to see the dimming effect
delay(30);
}
// fade GREEN LED in from min to max in increments of 5 points:
for (int fadeValue = 0 ; fadeValue <= 255; fadeValue += 5) {
// sets the value (range from 0 to 255) of the GREEN LED: