// Init the Pins used for PWM const int redPin = 9; const int greenPin = 10; const int bluePin = 11; // Init the Pins used for 10K pots const int redPotPin = 0; const int greenPotPin = 1; const int bluePotPin = 2; // Init our Vars int currentColorValueRed; int currentColorValueGreen; int currentColorValueBlue; void setup() { pinMode(redPin, OUTPUT); pinMode(greenPin, OUTPUT); pinMode(bluePin, OUTPUT); } void loop() { //static color event 1 currentColorValueRed = 255; currentColorValueBlue = 0; currentColorValueGreen = 0; // Write the color to each pin using PWM and the value gathered above analogWrite(redPin, currentColorValueRed); analogWrite(bluePin, currentColorValueBlue); analogWrite(greenPin, currentColorValueGreen); delay(3000); //color fade event 1 currentColorValueRed = 255; currentColorValueBlue = 0; currentColorValueGreen = 0; for( int i = 0 ; i < 255 ; i += 1 ){ currentColorValueGreen += 1; currentColorValueRed -= 1; analogWrite( greenPin, 255 - currentColorValueGreen ); analogWrite( redPin, 255 - currentColorValueRed ); delay( 30 ); } delay(3000); //static color event 2 currentColorValueRed = 25; currentColorValueBlue = 110; currentColorValueGreen = 40; // Write the color to each pin using PWM and the value gathered above analogWrite(redPin, currentColorValueRed); analogWrite(bluePin, currentColorValueBlue); analogWrite(greenPin, currentColorValueGreen); delay(1000); }