0
不應該我會發布波紋管的代碼讓我褪色的RGB LED從0到255,然後回到0等無限循環?Arduino衰落細節
在它只是消失的那一刻增長大,但隨後它不牛逼淡出,它閃爍了一下,但隨後再次完全在255
void setup()
{
Serial.begin(9600);
pinMode(greenPin, OUTPUT);
pinMode(redPin, OUTPUT);
pinMode(bluePin, OUTPUT);
fade = 0;
}
void loop()
{
while(fade < 256)
{
analogWrite(redPin, fade);
delay(30);
analogWrite(greenPin, fade);
delay(30);
analogWrite(bluePin, fade);
delay(30);
fade++;
}
while(fade > 0)
{
analogWrite(redPin, fade);
delay(30);
analogWrite(greenPin, fade);
delay(30);
analogWrite(bluePin, fade);
delay(30);
fade--;
}
}