I`m do it many times, with esp8266, nano, mega, etc.... and all was ok
But with ESP32 when i`m add just one line with AP initialization - LEDS go to flickering.
Whole of day i tried several ways to fix it like some defines, multicore, different leds libraries and forks.... but no result
Please help me, i just dont know where to find answer for now.
Thank you & sorry for my english!
IDE: Arduino IDE
Board: WEMOS D1 ESP-WROOM-32
ESP32 Core: 1.0.4
FastLED: 3.3.3
Minimal code to get flickering:
Code: Select all
#include "WiFi.h"
#include "FastLED.h"
#define DATA_PIN 22
#define LEDS_COUNT 24
#define LEDS_BRIGHT 42
#define MODULE_SSID "TEST_SSID"
#define MODULE_PASS "testpassword"
struct CRGB OLED_1[LEDS_COUNT];
void setup() {
Serial.begin(115200);
LEDS.addLeds<WS2811, DATA_PIN, GRB>(OLED_1, LEDS_COUNT).setCorrection(TypicalLEDStrip);
LEDS.setBrightness(LEDS_BRIGHT);
xTaskCreatePinnedToCore(LedsTask, "LedsTask", 10000, NULL, 1, NULL, 0);
// ALL LEDS WORKS PERFECT WHEN LINE BELOW IS COMMENTED
if(!WiFi.softAP(MODULE_SSID, MODULE_PASS)){Serial.println("INIT AP: FAILED");}
}
void loop() {
Serial.print("Message from core #"); Serial.println(xPortGetCoreID());
delay(4000);
}
void LedsTask( void * pvParameters ){
static int color = 0;
for(;;){
Serial.print("Message from core #"); Serial.println(xPortGetCoreID());
for (int i=0;i<LEDS_COUNT;i++){
OLED_1[i].setHSV(color, 255, 255);
LEDS.show(); delay(50);
}
color = color + 32 >= 255 ? 0 : color + 32;
delay(100);
}
}