I am having an issue using a NodeMCU ESP8266 and a P9813 Based LED Driver with FastLED.
This is the LED Driver: LED Driver
My code:
#define FASTLED_INTERRUPT_RETRY_COUNT 0
#define FASTLED_ESP8266_RAW_PIN_ORDER
#define FASTLED_FORCE_SOFTWARE_SPI
#include <FastLED.h>
#include <ESP8266WiFi.h>
#include <PubSubClient.h>
#define NUM_LEDS 5
#define DATA_PIN 5
#define CLOCK_PIN 4
int red = 255;
int green = 0;
int blue = 0;
CRGB leds[NUM_LEDS];
void setup() {
FastLED.addLeds<P9813, DATA_PIN, CLOCK_PIN , RGB>(leds, NUM_LEDS);
Serial.begin(9600);
for (int x = 0; x < 5; x++) {
leds[x] = CRGB::White;
}
FastLED.show();
delay(500);
}
void loop() {
for (int y = 255; y >= 0; y--) {
for (int x = 0; x < 5; x++) {
leds[x].r = y;
leds[x].g = 255 - y;
leds[x].b = 0;
}
FastLED.show();
delay(20);
}
for (int y = 255; y >= 0; y--) {
for (int x = 0; x < 5; x++) {
leds[x].r = 0;
leds[x].g = y;
leds[x].b = 255 - y;
}
FastLED.show();
delay(20);
}
for (int y = 255; y >= 0; y--) {
for (int x = 0; x < 5; x++) {
leds[x].r = 255 - y;
leds[x].g = 0;
leds[x].b = y;
}
FastLED.show();
delay(20);
}
}
The code simply cycles through the RGB spectrum.
When running, all LED strips occasionally flash White or Blink very quickly and I am not sure why.
I tried using the ChainableLED library and this worked well, but would just stop working and freeze the colours.
I really would like to get FastLED running but I need to get rid of this issue. I don’t know if it is todo with not having any SPI pins and the data not getting through, but I have seen other examples on the web of using an ESP8266 to control these. Or could it be a data transmission speed problem?
Thanks!