Rotating colors using the RGB bulb.
int pins[3] = {10,9,6};
void setup(){
Serial.begin(9600);
for(int ctr = 0; ctr < 3; ctr++){
pinMode(pins[ctr],OUTPUT);
Serial.println(pins[ctr]);
}
}
void loop(){
rgb(255,255,255);
rgb(255,000,000);
rgb(255,255,000);
rgb(000,255,000);
rgb(000,255,255);
rgb(000,000,255);
rgb(255,000,255);
}
Using my own custom function, I pass the red, green and blue values.
void rgb(int r, int g, int b){
analogWrite(pins[0],r);
analogWrite(pins[1],g);
analogWrite(pins[2],b);
delay(1000);
}