Advertisement
Guest User

Simple running light - FastLED

a guest
Dec 21st, 2015
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.77 KB | None | 0 0
  1. #include <FastLED.h>
  2.  
  3. #if FASTLED_VERSION < 3001000
  4. #error "Requires FastLED 3.1 or later; check github for latest code."
  5. #endif
  6.  
  7. #define DATA_PIN    2
  8. #define LED_TYPE    NEOPIXEL
  9. #define COLOR_ORDER GRB
  10. #define NUM_LEDS    32
  11. #define BRIGHTNESS 96
  12.  
  13. CRGB leds[NUM_LEDS];
  14.  
  15.  
  16. void setup() {
  17.  delay(3000); // 3 second delay for recovery
  18.  
  19.   // tell FastLED about the LED strip configuration
  20.   FastLED.addLeds<LED_TYPE,DATA_PIN,COLOR_ORDER>(leds, NUM_LEDS).setCorrection(TypicalLEDStrip).setDither(false);
  21.   FastLED.setBrightness(BRIGHTNESS);
  22.   fill_solid(leds, NUM_LEDS, CRGB::Black);
  23.   FastLED.show();
  24. }
  25.  
  26.  
  27.  
  28. // magic happens in here
  29. void loop()
  30. {
  31.     fadeToBlackBy( leds, NUM_LEDS, 20);
  32.     leds[beatsin16(20,0,NUM_LEDS)] = CRGB::Red;
  33.     FastLED.show();
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement