// RGB LED output pins (these must be PWM-capable,
// choose with only those with ~ symbol;
// allowed range of integer output values: [0, 255]):
int red = 11;
int green = 10;
int blue = 9;
void setup() {
// put your setup code here, to run once:
pinMode(red, OUTPUT); // designates Digital Pin 11 to be an output pin
pinMode(green, OUTPUT);
pinMode(blue, OUTPUT);
}
void RGB_color(int red_value, int green_value, int blue_value) {
analogWrite(red, red_value); // value of red_value needs to be between 0 and 255 for PWM.
analogWrite(green, green_value);
analogWrite(blue, blue_value);
}
void loop () {
// put your main code here, to run repeatedly:
RGB_color(125, 0, 0); // Red
delay(800);
RGB_color(0, 125, 0); // Green
delay(800);
RGB_color(0, 0, 125); // Blue
delay(800);
RGB_color(64, 32, 0); // Yellow (could be different values, this is just a visual approximation)
delay(800);
RGB_color(125, 0, 125); // Purple
delay(800);
RGB_color(125, 125, 125); // White
delay(2000);
}