Advertisement
computermuseo

animazione led con cambio colore ws2812b

Mar 23rd, 2017
1,689
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1. #include<FastLED.h>
  2. #define NUM_LEDS 30
  3.  
  4. CRGBArray<NUM_LEDS> leds;
  5.  
  6. void setup() { FastLED.addLeds<NEOPIXEL,6>(leds, NUM_LEDS); }
  7.  
  8. void loop(){
  9. static uint8_t hue;
  10. for(int i = 0; i < NUM_LEDS/2; i++) {
  11. // fade everything out
  12. leds.fadeToBlackBy(40);
  13.  
  14. // let's set an led value
  15. leds[i] = CHSV(hue++,255,255);
  16.  
  17. // now, let's first 20 leds to the top 20 leds,
  18. leds(NUM_LEDS/2,NUM_LEDS-1) = leds(NUM_LEDS/2 - 1 ,0);
  19. FastLED.delay(33);
  20. }
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement