int BreathingLight[3]={3,5,9};
void setup() {
// put your setup code here, to run once:
for(int i=0;i<=2;i++)
{
pinMode(BreathingLight[i],OUTPUT);
}
}
void loop() {
// put your main code here, to run repeatedly:
for(int j=0;j<=2;j++)//三盏灯按次序点亮
{
for (int i=0;i<=255;i++)
{
analogWrite(BreathingLight[j],i);//以PWM方式亮度逐渐增加
delay(10);//当前状态维持时间
}
for (int i=255;i>=0;i--)
{
analogWrite(BreathingLight[j],i);//以PWM方式亮度逐渐减弱
delay(10);//当前状态维持时间
}
delay(500);//每盏灯熄灭后到下盏灯开始亮的等待时间
}
}