Hello!
I have another problem with my esp 32 webserver...
Yesterday everything worked fine but now the Esp is randomly restarting...
Here ist my code:
#include <Arduino.h>
#include <WiFi.h>
#include <AsyncTCP.h>
#include <ESPAsyncWebServer.h>
#include "FS.h"
#include "SD.h"
#include "SPI.h"
#include <Adafruit_NeoPixel.h>
Adafruit_NeoPixel strip(12, 25, NEO_GRB + NEO_KHZ800);
// Replace with your network credentials
const char* ssid = "WLAN";
const char* password = "12345678";
// Create AsyncWebServer object on port 806
AsyncWebServer server(80);
void initSDCard(){
if(!SD.begin()){
Serial.println("Card Mount Failed");
return;
}
uint8_t cardType = SD.cardType();
if(cardType == CARD_NONE){
Serial.println("No SD card attached");
return;
}
Serial.print("SD Card Type: ");
if(cardType == CARD_MMC){
Serial.println("MMC");
} else if(cardType == CARD_SD){
Serial.println("SDSC");
} else if(cardType == CARD_SDHC){
Serial.println("SDHC");
} else {
Serial.println("UNKNOWN");
}
uint64_t cardSize = SD.cardSize() / (1024 * 1024);
Serial.printf("SD Card Size: %lluMB\n", cardSize);
}
void initWiFi() {
WiFi.mode(WIFI_STA);
WiFi.begin(ssid, password);
Serial.print("Connecting to WiFi ..");
while (WiFi.status() != WL_CONNECTED) {
Serial.print('.');
delay(1000);
}
Serial.println(WiFi.localIP());
}
void setup() {
Serial.begin(115200);
strip.begin();
strip.show();
initWiFi();
initSDCard();
server.on("/", HTTP_GET, [](AsyncWebServerRequest *request){
request->send(SD, "/index.html", "text/html");
int paramsNr = request->params();
Serial.println(paramsNr);
for(int i=0;i<paramsNr;i++){
AsyncWebParameter* p = request->getParam(i);
Serial.print("Param name: ");
Serial.println(p->name());
Serial.print("Param value: ");
Serial.println(p->value());
Serial.println("------");
int number = (int)strtol(&(p->value().c_str())[1], NULL, 16);
Serial.println(number);
int r = number >> 16;
int g = number >> 8 & 0xFF;
int b = number & 0xFF;
// DEBUG
Serial.print("RGB: ");
Serial.print(r, DEC);
Serial.print(" ");
Serial.print(g, DEC);
Serial.print(" ");
Serial.print(b, DEC);
Serial.println(" ");
for(int i=0; i < 12; i++) {
strip.setPixelColor(i, strip.Color( r, g, b ) );
delay(100);
strip.show();
}
}
});
server.serveStatic("/", SD, "/");
server.begin();
}
void loop() {
}
and here are the errors:
E (70403) task_wdt: Task watchdog got triggered. The following tasks did not reset the watchdog in time:
E (70403) task_wdt: - async_tcp (CPU 0)
E (70403) task_wdt: Tasks currently running:
E (70403) task_wdt: CPU 0: IDLE0
E (70403) task_wdt: CPU 1: loopTask
E (70403) task_wdt: Aborting.
abort() was called at PC 0x4013ef1c on core 0
ELF file SHA256: 0000000000000000
Backtrace: 0x40088b4c:0x3ffbf850 0x40088dc9:0x3ffbf870 0x4013ef1c:0x3ffbf890 0x400874a9:0x3ffbf8b0 0x401521cb:0x3ffbc250 0x40140817:0x3ffbc270 0x4008c03d:0x3ffbc290 0x4008a88e:0x3ffbc2b0
Rebooting...
ets Jun 8 2016 00:22:57
rst:0xc (SW_CPU_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:1
load:0x3fff0018,len:4
load:0x3fff001c,len:1216
ho 0 tail 12 room 4
load:0x40078000,len:10944
load:0x40080400,len:6388
entry 0x400806b4
Connecting to WiFi .....192.168.137.138
SD Card Type: SDHC
SD Card Size: 3750MB
Thanks in advance!!