int pwm = 9; // This is the pin that we will use
void setup() {
pinMode(pwm, OUTPUT); // declare the pin to be an output
}
void loop() {
delay(1000);
//blue // wait for a second
for(int i=0; i<256; i++) // Increase brightness from 0 to 255
{
analogWrite(pwm, i); // Set the duty cycle to i
delay(10); // Wait for 10ms
}
for(int i=255; i>=0; i--) // Decrease brightness from 255 to 0
{
analogWrite(pwm, i); // Set the duty cycle to i
delay(10); // Wait for 10ms
}
}