voidloop(){ for (int i = 0; i <= 255; i = i + (5)) {//for循环步长为5,控制明暗变化细腻程度 analogWrite(3, i);//13号管脚进行模拟输出 delay(20);//延时20ms,控制呼吸速率 } for (int i = 255; i >= 0; i = i + (-5)) { analogWrite(3, i); delay(20); }
voidloop(){ for (int i = 2; i <= 4; i = i + (1)) { pinMode(i, OUTPUT); digitalWrite(i,HIGH); delay(100); pinMode(i, OUTPUT); digitalWrite(i,LOW); } for (int i = 4; i >= 2; i = i + (-1)) { pinMode(i, OUTPUT); digitalWrite(i,HIGH); delay(100); pinMode(i, OUTPUT); digitalWrite(i,LOW); }