Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* Simple FastLED circle
- *
- *
- */
- #include <FastLED.h> // FastLED library.
- #ifdef ESP8266
- #define FASTLED_ALLOW_INTERRUPTS 0 // Used for ESP8266 with WS2812 LED's. Ugh!!!
- #endif
- // Fixed definitions cannot change on the fly.
- #define LED_DT D4 // Data pin to connect to the strip.
- #define COLOR_ORDER GRB // It's GRB for WS2812 and BGR for APA102.
- #define LED_TYPE WS2812
- #define NUM_LEDS 30 // Number of LED's.
- uint8_t max_bright = 64; // Overall brightness definition. It can be changed on the fly.
- struct CRGB leds[NUM_LEDS]; // Initialize our LED array.
- void setup() {
- LEDS.addLeds<LED_TYPE, LED_DT, COLOR_ORDER>(leds, NUM_LEDS); // Use this for WS2812
- FastLED.setBrightness(max_bright);
- } // setup()
- void loop() {
- fadeToBlackBy(leds, NUM_LEDS, 4); // Smaller value = longer tail
- int i = (millis()/40) % NUM_LEDS; // How fast it goes.
- leds[i] = CRGB::White;
- FastLED.show();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement