/* control RGB Led with PWM matt R, 3/18/2012 */ int rPin = 3, gPin = 5, bPin = 6;// red,green,blue led pins int rPWM = 0, gPWM = 85, bPWM = 170;// PWM values for the leds void setup(){ Serial.begin(9600); } void loop(){ rPWM = rPWM + 1; if(rPWM >= 255){ rPWM = 0; } analogWrite( rPin, rPWM); gPWM = gPWM + 1; if(gPWM >= 255){ gPWM = 0; } analogWrite( gPin, gPWM); bPWM = bPWM + 1; if(bPWM >= 255){ bPWM = 0; } analogWrite( bPin, bPWM); delay(50); }