//Defining variable and the GPIO pin on Arduino
int R_Pin= 5;
int G_Pin = 6;
int B_Pin = 7;
void setup() {
//Defining the pins as OUTPUT
pinMode(R_Pin, OUTPUT);
pinMode(G_Pin, OUTPUT);
pinMode(B_Pin, OUTPUT);
}
void loop() {
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);
setColor(255, 51, 153); // Pink
delay(1000);
}
void setColor(int R_Value, int G_Value, int B_Value) {
analogWrite(R_Pin, R_Value);
analogWrite(G_Pin, G_Value);
analogWrite(B_Pin, B_Value);
}