Hello to everyone.
I've made wifi controller for traditional RGB led strips using ESP8266 and Blynk and it works great.
But now I've got a RGB PIXEL LED WS2812 strip, and I want to use the same board to control everything.
I've found a weird issue that I cant understand.
Here is a simple code that flash all pixel leds ON and OFF every 250 milliseconds. It works OK until I use the analogWrite function. If I uncomment the analogWrite line, I start to see some individual leds randomly changing color. I've tried different DATA_PIN and different pins on the analogWrite() but still the same. I've tried two different ESP8266 boards (wemos and NodeMcu) and still the same issue.
Any Ideas??
Thank you.
#include <FastLED.h>
#define DATA_PIN 05
#define CANT 28
#define BRIGHTNESS 150
CRGB leds[CANT];
unsigned long syncLastFlash = 0;
boolean lightOn = true;
void setup()
{
FastLED.addLeds<WS2812, DATA_PIN, GRB>(leds, CANT).setCorrection( TypicalLEDStrip );
FastLED.setBrightness(BRIGHTNESS);
//analogWrite(13, 100); // This line cause some LEDs to randomly change color
}
void loop()
{
if (millis() - syncLastFlash > 250)
{
syncLastFlash = millis();
lightOn = !lightOn;
if (lightOn == true)
{
for (byte j = 0; j < CANT; j++)
leds[j] = CRGB(0, 0, 200);
FastLED.show();
}
else
{
for (byte j = 0; j < CANT; j++)
leds[j] = CRGB(0, 0, 0);
FastLED.show();
}
}
}