Guest User

BlueMushroom

a guest
Jun 20th, 2016
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.75 KB | None | 0 0
  1. #include "FastLED.h"
  2.  
  3. #define FASTLED_ALLOW_INTERRUPTS 0
  4.  
  5. const uint8_t ledPin = 1;
  6.  
  7. //37 + (18 * 2) + (14 * 4)
  8. const uint16_t kNumLeds = 129;
  9.  
  10. CRGB leds[kNumLeds];
  11.  
  12. uint8_t i = 0;
  13. uint8_t hue = 0;
  14.  
  15. void setup() {
  16.     delay(2000);
  17.  
  18.     FastLED.addLeds<WS2812, ledPin, RGB>(leds, kNumLeds);
  19. //    FastLED.setBrightness(64);
  20. }
  21.  
  22. void loop() {
  23. //  firstLight();
  24.   glow();
  25. }
  26.  
  27. void firstLight() {
  28.    for(int whiteLed = 0; whiteLed < kNumLeds; whiteLed = whiteLed + 1) {
  29.       leds[whiteLed] = CRGB::White;
  30.       FastLED.show();
  31.       delay(100);
  32.       leds[whiteLed] = CRGB::Black;
  33.    }
  34. }
  35.  
  36. void glow() {
  37.   i++;
  38.   if (i == 0) {
  39.     hue = random8();    
  40.   }
  41.   fill_solid(leds, kNumLeds, CHSV(hue, 255, sin8(i)));
  42.   FastLED.show();
  43. }
Advertisement
Add Comment
Please, Sign In to add comment