int redPin = 7;
int greenPin = 9;
int bluePin = 11;
void setup() {
pinMode(redPin,OUTPUT);
pinMode(greenPin,OUTPUT);
pinMode(bluePin,OUTPUT);
}
void breath(int colorValue,int colorPin)
{
for(int colorValue = 0;colorValue <= 255;colorValue += 5)
{
analogWrite(colorPin,colorValue);
delay(30);
}
for(int colorValue = 255;colorValue >= 0;colorValue -= 5)
{
analogWrite(colorPin,colorValue);
delay(30);
}
}
void loop()
{
int redValue,greenValue,blueValue;
breath(redValue,redPin);
breath(greenValue,greenPin);
breath(blueValue,bluePin);
}