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