I am working on HTTP GET Request. I have created ESP wifi as web server. It creates a access point with IP address : 192.168.4.1 When my android app is connected to web server, it sends values every 50ms on 192.168.4.1/R"VALUE". Value is integer type (0~1023). Example :- 192.168.4.1/R546
However, it is working fine when I send values every 1s, but esp crashes, when IP is hit every 5ms second. I have captured the crash detail on serial monitor. Attaching the file and code as well. Kindly help.
#include <ESP8266WiFi.h>
#include <EEPROM.h>
#include <ESP8266WebServer.h>
#define RED_LED 12
WiFiServer server(80); //Initialize the server on Port 80
char myTestUrl[100];
void setup()
{
EEPROM.begin(512);
Serial.begin(9600); //Start communication between the ESP8266-12E and the monitor window
WiFi.mode(WIFI_AP); //Our ESP8266-12E is an AccessPoint
WiFi.softAP("LED_Downlight1", "12345678"); // Provide the (SSID, password); .
server.begin(); // Start the HTTP Server
IPAddress HTTPS_ServerIP = WiFi.softAPIP(); // Obtain the IP of the Server
Serial.print("Server IP is: "); // Print the IP to the monitor window
Serial.println(HTTPS_ServerIP);
}
void loop()
{
WiFiClient client = server.available();
if (!client)
{
return;
}
String request = client.readStringUntil('\r');
//Serial.print(request);
request.toCharArray(myTestUrl, 100);
char *Red = strstr(myTestUrl, "/R");
if (Red)
{
int RedValue = atoi(Red + 2);
analogWrite(RED_LED, RedValue);
Serial.print("Red: ");
Serial.print(" ");
Serial.print(RedValue);
Serial.print("\n");
int SetRedValue = (RedValue / 4);
EEPROM.write(0, SetRedValue);
EEPROM.commit();
Serial.print("Red Memory Write :");
Serial.print(" ");
Serial.print(SetRedValue);
Serial.print("\n \n");
}
}