Skip to content

Instantly share code, notes, and snippets.

@jasoncoon
Last active February 15, 2018 03:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jasoncoon/912748d2695c9bfd83bc09d53b1a2528 to your computer and use it in GitHub Desktop.
Save jasoncoon/912748d2695c9bfd83bc09d53b1a2528 to your computer and use it in GitHub Desktop.
FastLED ESP32 Test
#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