Advertisement
Guest User

Untitled

a guest
Feb 15th, 2019
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.91 KB | None | 0 0
  1. #include <FastLED.h>
  2.  
  3. #define LED_PIN     6
  4. #define COLOR_ORDER GRB
  5. #define CHIPSET     WS2812B
  6. #define NUM_LEDS    144
  7.  
  8. #define BRIGHTNESS  255
  9. #define FRAMES_PER_SECOND 24
  10.  
  11. CRGB leds[NUM_LEDS];
  12.  
  13. void setup() {
  14.   FastLED.addLeds<CHIPSET, LED_PIN, COLOR_ORDER>(leds, NUM_LEDS).setCorrection( TypicalLEDStrip );
  15.   FastLED.setBrightness( BRIGHTNESS );
  16. }
  17.  
  18. void loop() {
  19.   ledsOn();
  20.  
  21.   FastLED.delay(5000);
  22.  
  23.   for(int i=NUM_LEDS;i>0;i--){
  24.     leds[i] = CHSV( 0, 0, 0);
  25.     FastLED.show();
  26.     FastLED.delay(1000 / FRAMES_PER_SECOND);
  27.   }  
  28.  
  29.   FastLED.delay(5000);
  30. }
  31.  
  32. void ledsOn() {
  33.   for(int i=0;i<NUM_LEDS;i++){
  34.     int b = map(i, 0, NUM_LEDS, 0, 255);
  35.     leds[i] = CHSV(255,0,b);
  36.     FastLED.show();
  37.     FastLED.delay(1000 / FRAMES_PER_SECOND);
  38.   }
  39.   for(int i=NUM_LEDS;i>0;i--){
  40.     leds[i] = CHSV(255,0,255);
  41.     FastLED.show();
  42.     FastLED.delay(1000 / FRAMES_PER_SECOND);
  43.   }
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement