怎样改才能让他不循环流水
#include <Adafruit_NeoPixel.h>
#define PIN 6 //LED端口
Adafruit_NeoPixel strip = Adafruit_NeoPixel(36, PIN, NEO_RGB + NEO_KHZ800);
void setup() {
strip.begin();
strip.show(); //初始化
}
void loop() {
rainbowCycle(10);//5速度,越小越快
}
void rainbowCycle(uint8_t wait)
{
uint16_t i,j;
for(j=0; j<256*5; j++)
{
for(uint16_t i=0; i<strip.numPixels(); i++)
{
strip.setPixelColor(i, Wheel(((i * 256 / strip.numPixels()) + j) & 255));
}
strip.show();
delay(wait); // 延迟(等待);
}
}
uint32_t Wheel(byte WheelPos) {
if(WheelPos < 290)//拖尾长度
{
return strip.Color( WheelPos ,WheelPos , WheelPos ); //前跑馬灯颜色
}
else
{
return strip.Color( 0, 0, 0); //背景灯光颜色
}
} |