Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "FastLED.h"
- #define FASTLED_ALLOW_INTERRUPTS 0
- const uint8_t ledPin = 1;
- //37 + (18 * 2) + (14 * 4)
- const uint16_t kNumLeds = 129;
- CRGB leds[kNumLeds];
- uint8_t i = 0;
- uint8_t hue = 0;
- void setup() {
- delay(2000);
- FastLED.addLeds<WS2812, ledPin, RGB>(leds, kNumLeds);
- // FastLED.setBrightness(64);
- }
- void loop() {
- // firstLight();
- glow();
- }
- void firstLight() {
- for(int whiteLed = 0; whiteLed < kNumLeds; whiteLed = whiteLed + 1) {
- leds[whiteLed] = CRGB::White;
- FastLED.show();
- delay(100);
- leds[whiteLed] = CRGB::Black;
- }
- }
- void glow() {
- i++;
- if (i == 0) {
- hue = random8();
- }
- fill_solid(leds, kNumLeds, CHSV(hue, 255, sin8(i)));
- FastLED.show();
- }
Advertisement
Add Comment
Please, Sign In to add comment