Problem:
While trying to use an ESP8266 D1 mini Arduino board to control some addressable WS8211 LEDs, I found that it didn't seem to work.
Solution:
After some reading, I found that the pin numbering didn't line up the way I thought it would. I'm not sure if this is a bug in FastLED or the result of using a D1 clone, but once I had this information everything started working perfectly. (Note, my board layout is a bit different, but this still applied.) -- easiest solution is to use D2 label for GPIO4.
Source: https://github.com/FastLED/FastLED/issues/542#issuecomment-355667857
Here is the working test sketch:
#include <FastLED.h>
#define DATA_PIN 4 // but plug into pin 2 or use D4
#define LED_BRIGHTNESS 50 // global brightness setting (might change for HSV)
#define LED_COUNT 50 // lights per pin
CRGB leds[LED_COUNT];
void setup() {
Serial.begin(9600);
delay(1000);
FastLED.setBrightness(LED_BRIGHTNESS);
FastLED.addLeds<WS2811, DATA_PIN>(leds, LED_COUNT);
fill_solid(leds, LED_COUNT, CRGB::Black);
FastLED.show();
}
void loop() {
cd77_colorwipe_dot(CRGB::Red, 10);
}
void cd77_colorwipe_dot(CRGB color, uint16_t wait) {
for (byte led = 0; led < LED_COUNT; led++) {
leds[led] = color;
FastLED.delay(wait);
leds[led] = CRGB::Black;
FastLED.show();
}
}