Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "FastLED.h"
- #define NUM_LEDS 100
- #define LED_DATA_PIN 3
- #define BRIGHTNESS 255
- #define UPDATES_PER_SECOND 60
- CRGB leds[NUM_LEDS];
- // Animation attributes
- CRGBPalette16 currentPalette = RainbowColors_p;
- TBlendType currentBlending = LINEARBLEND;
- uint8_t startIndex = 0;
- void setup()
- {
- FastLED.addLeds<WS2812B, LED_DATA_PIN, GRB>(leds, NUM_LEDS);
- FastLED.setBrightness(BRIGHTNESS);
- }
- void loop()
- {
- startIndex++;
- uint8_t colorIndex = startIndex;
- for(int i = 0; i < NUM_LEDS; i++) {
- leds[i] = ColorFromPalette(currentPalette, colorIndex, BRIGHTNESS, currentBlending);
- colorIndex += 3;
- }
- FastLED.delay(1000 / UPDATES_PER_SECOND);
- }
Advertisement
Add Comment
Please, Sign In to add comment