标签:setup delay col bsp val mod als pre red
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); }
标签:setup delay col bsp val mod als pre red
原文地址:https://www.cnblogs.com/zhongllmm/p/14089642.html