Wifi esp8266 error when use adafruit_neopixel

Please tell us which board you are using.
For CircuitPython issues, ask in the Adafruit CircuitPython forum.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
luckystar95
 
Posts: 1
Joined: Fri Oct 08, 2021 5:13 am

Wifi esp8266 error when use adafruit_neopixel

Post by luckystar95 »

Hi everybody. I have a question.
I use AP wifi on esp8266 and adafruit_neopixel to control 300 ws2812 leds with high frequency. after each show() function I use delay(1). Unfortunately, the system ran 15s then the wifi died. But i use delay(10) after show(),it works ok.
This is my code:

Code: Select all

#include <Adafruit_NeoPixel.h>
#include <ESP8266WiFi.h>

#define PIN        D5
#define NUMPIXELS 300
Adafruit_NeoPixel pixels(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800);

#define APSSID "TestWIFI"
#define APPSK  "12345678"

/* Set these to your desired credentials. */
const char *ssid = APSSID;
const char *password = APPSK;

void setup() {
  WiFi.softAP(ssid, password);
  pixels.begin(); // INITIALIZE NeoPixel strip object (REQUIRED)
}

void loop() {
  pixels.clear(); // Set all pixel colors to 'off'
  for(int i=0; i<NUMPIXELS; i++) { // For each pixel...
    pixels.setPixelColor(i, pixels.Color(0, 150, 0));
    pixels.show();   // Send the updated pixel colors to the hardware.
    delay(1); // Pause before next pass through loop
  }
}

User avatar
dastels
 
Posts: 15662
Joined: Tue Oct 20, 2015 3:22 pm

Re: Wifi esp8266 error when use adafruit_neopixel

Post by dastels »

Just a guess, but I suspect the longer delay gives the wifi stack a chance to do required background processing.

[edit] Confirmed: in the docs in the ESP8266 Arduino support repo https://github.com/esp8266/Arduino/blob ... erence.rst:
delay(ms) pauses the sketch for a given number of milliseconds and allows WiFi and TCP/IP tasks to run.
Dave

Locked
Please be positive and constructive with your questions and comments.

Return to “Feather - Adafruit's lightweight platform”