LED Animations start to lag or skip after around 5-7 seconds

As the title says, when I upload my code, it is just supposed to blink random leds on a strip of 76 WS2812B LEDs however after around 5 seconds the leds start to “lag” or skip frames and stop for a second then continues randomly. Ive tried restarting the arduino it didnt work.

For more detail on the “lag” the leds go from randomly turning on every 100ms to about 500ms to 1000ms and it is just random after that.

LOLIN(WEMOS) D1 mini(clone) + WIFI
Android 12
Blynk Server ([URL removed by moderator]) and the normal Ive tried both.
v1.2.0

#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#include <FastLED.h>

char auth[] = "x";
char ssid[] = "x";
char pass[] = "x";

#define NUM_LEDS       77
#define LED_PIN        2
#define LED_TYPE       WS2812B
#define COLOR_ORDER    GRB

CRGB leds[NUM_LEDS];

void setup() {
  FastLED.addLeds<LED_TYPE, LED_PIN, COLOR_ORDER>(leds, NUM_LEDS);
  Blynk.begin(auth, ssid, pass);
  // vvv I wanted to use this, and Ive used this before in other code but it wont work for this vvv
  //Blynk.begin(auth, ssid, pass, [URL removed by moderator]);
  Serial.begin(115200);
}

void loop() {
  Blynk.run();

  leds[random(0,76)] = CHSV(0,0,255);
  FastLED.show();
  delay(100);
  FastLED.clear();
}

Also I edited out the wifi stuff, it isnt actually x.

Please read this

Https://docs.blynk.io/en/legacy-platform/legacy-articles/keep-your-void-loop-clean

1 Like

@McPersun I’ve removed the references to the illegally hosted Blynk Legacy server.

If you wish to use Blynk IoT then you should be including the three lines of configuration firmware from the DEvice > Device Info screen in your sketch - preferably at the very beginning of the sketch, and changing this line…

to this…

Blynk.begin(BLYNK_AUTH_TOKEN, ssid, pass);

Pete.