Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "FastLED.h"
- #define LEDPIN 6
- #define LED_TYPE NEOPIXEL
- #define NUM_LEDS 512
- #define BRIGHTNESS 100
- #define FRAMES_PER_SECOND 12
- CRGB leds[NUM_LEDS];
- void setup() {
- //sanity delay
- delay(3000);
- // set up LED strip info
- FastLED.addLeds<LED_TYPE,LEDPIN>(leds,NUM_LEDS).setCorrection(TypicalLEDStrip);
- FastLED.setBrightness(BRIGHTNESS);
- }
- void loop() {
- //changing the third variable changes how quickly the lights fade
- fadeLightBy( leds, NUM_LEDS, 1);
- //changing this variable will increase the chance of a "star" popping up
- addGlitter(450);
- FastLED.show();
- }
- //glitter effect
- void addGlitter( fract8 chanceOfGlitter) {
- if( random8() < chanceOfGlitter) {
- leds[ random16(NUM_LEDS) ] += CRGB::White;}
- }
Advertisement
Add Comment
Please, Sign In to add comment