Last active
February 15, 2018 03:28
-
-
Save jasoncoon/912748d2695c9bfd83bc09d53b1a2528 to your computer and use it in GitHub Desktop.
FastLED ESP32 Test
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "FastLED.h" | |
#define DATA_PIN 18 | |
#define NUM_LEDS 14 | |
CRGB leds[NUM_LEDS]; | |
uint8_t gHue = 0; | |
void setup() { | |
pinMode(DATA_PIN, OUTPUT); | |
LEDS.addLeds<WS2812B, DATA_PIN, GRB>(leds, NUM_LEDS); | |
LEDS.setBrightness(64); | |
} | |
void my_fill_solid(struct CRGB * leds, int numToFill, const struct CRGB& color) { | |
for (int i = 0; i < numToFill; i++) { | |
leds[i] = color; | |
} | |
} | |
void my_fill_solid_2(CHSV color) { | |
for (int i = 0; i < NUM_LEDS; i++) { | |
leds[i] = color; | |
} | |
} | |
void works() { | |
CHSV color = CHSV(gHue, 255, 255); | |
for (int i = 0; i < NUM_LEDS; i++) { | |
leds[i] = color; | |
} | |
} | |
void loop() { | |
CHSV color = CHSV(gHue, 255, 255); | |
// resets | |
// fill_solid(leds, NUM_LEDS, color); | |
// also resets | |
// my_fill_solid(leds, NUM_LEDS, color); | |
// also resets | |
// my_fill_solid_2(color); | |
works(); | |
FastLED.show(); | |
delay(8); // also resets without this delay | |
gHue++; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment