int R=8,G=9,B=10;
// LED Common Cathode
void setup() {
Serial.begin(9600);
for(int i=8;i<11;i++){
pinMode(i, OUTPUT);
// Just for testing
Serial.print("setting pin");
Serial.println(i);
}
}
void loop() {
setColor(255, 255, 255); // White Color
delay(300);
setColor(0, 0, 255); // Blue Color
delay(300);
}
void setColor(int red,int green, int blue){
//Code correction for cathode
red = abs(255-red);
blue= abs(255-blue);
green= abs(255-green);
analogWrite(R, red);
analogWrite(G, green);
analogWrite(B, blue);
}