void setup() {
// put your setup code here, to run once:
pinMode(5, OUTPUT); // R
pinMode(6, OUTPUT); //G
pinMode(3, OUTPUT); // B
}
void loop() {
// put your main code here, to run repeatedly:
setColor(255, 0, 0); // Red Color
delay(1000);
setColor(0, 255, 0); // Green Color
delay(1000);
setColor(0, 0, 255); // Blue Color
delay(1000);
setColor(255, 255, 255); // White Color
delay(1000);
setColor(170, 0, 255); // Purple Color
delay(1000);
setColor(127, 127, 127); // Light Blue
delay(1000);
}
void setColor(int redValue, int greenValue, int blueValue) {
analogWrite(5, redValue);
//digitalWrite (5, redValue);
analogWrite(6, greenValue);
//digitalWrite(6, greenValue);
analogWrite(3, blueValue);
//digitalWrite(3,blueValue);
}