Arduino驅動WS2812B流動彩虹效果


Arduino驅動WS2812B流動彩虹效果

 1 void rainbow(int wait) {
 2 
 3   for(long firstPixelHue = 0; firstPixelHue < 3*65536; firstPixelHue += 256) {
 4 
 5     for(int i=0; i<strip.numPixels(); i++) {
 6 
 7       int pixelHue = firstPixelHue + (i * 65536L / strip.numPixels());
 8 
 9       strip.setPixelColor(i, strip.gamma32(strip.ColorHSV(pixelHue)));
10 
11     }
12 
13     strip.show(); // Update strip with new contents
14 
15     delay(wait);  // Pause for a moment
16 
17   }
18 
19 }

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM