|
void rainbow(){
Serial.println(ch);
ch = ' ';
while(1){
for(uint16_t j=0; j<256; j++) {
for(uint16_t i=0; i<strip.numPixels(); i++) {
strip.setPixelColor(i, Wheel((i+j) & 255));
ch = Serial.read();
if(ch == 'F'){
RGB_LED_Off();
return;
}
}
strip.show();
delay(20);
}
for(uint16_t j=0; j<256*5; j++) { // 5 cycles of all colors on wheel 在全彩色谱内循环5次
for(uint16_t i=0; i< strip.numPixels(); i++) {
strip.setPixelColor(i, Wheel(((i * 256 / strip.numPixels()) + j) & 255));
ch = Serial.read();
if(ch == 'F'){
RGB_LED_Off();
return;
}
}
strip.show();
delay(20);
}
for (int j=0; j < 256; j++) { // cycle all 256 colors in the wheel 按全彩色谱转圈
for (int q=0; q < 3; q++) {
for (int i=0; i < strip.numPixels(); i=i+3) {
strip.setPixelColor(i+q, Wheel( (i+j) % 255)); //turn every third pixel on 以三盏灯一组点亮
ch = Serial.read();
if(ch == 'F'){
RGB_LED_Off();
return;
}
}
strip.show();
delay(50);
for (int i=0; i < strip.numPixels(); i=i+3) {
strip.setPixelColor(i+q, 0); //turn every third pixel off 以三盏灯一组熄灭
}
}
}
}
}
就是这样了,把函数改一下 |
|