I made an App to send 3 numbers( second and minute and hour ) to esp8266 wemos d1 mini and showing in terminal but getting an error 1101.
my arduino code :
#ifdef ESP32
#include <WiFi.h>
#include <AsyncTCP.h>
#else
#include <ESP8266WiFi.h>
#include <ESPAsyncTCP.h>
#endif
#include <ESPAsyncWebServer.h>
// Enter your network credentials here
const char* ssid = "***";
const char password = "********";
// Set web server at port 80
WiFiServer server(80);
// Storing the HTTP request
String header;
// second , minute , hour Values
int SecVal = 0;
int MinVal = 0;
int HoueVal = 0;
void setup() {
Serial.begin(115200);
// Connect to Wi-Fi network with SSID and password
Serial.print("Connecting to ");
Serial.println(ssid);
WiFi.begin(ssid,password);
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
}
// Print ESP32 IP address and start web server
Serial.println("");
Serial.println("WiFi connected.");
Serial.println("IP address: ");
Serial.println(WiFi.localIP());
server.begin();
}
void loop(){
WiFiClient client = server.available(); // listen for incoming clients
if (client) { // if a new client connects,
Serial.println("New Client.");
String currentLine = ""; // 'currentLine' stores the current line of the request
while (client.connected()) {
if (client.available()) { // checks if there are unread characters from the request
char c = client.read(); // c stores the current character we are reading
Serial.write(c);
header += c; // we'll store the entire request in 'header'
if (c == '\n') {
if (currentLine.length() == 0) {
/* Note that we'll only enter this conditional with a double line break
('\n' on empty line) which signifies the end of an http request */
/* HTTP headers always start with a response code (e.g. HTTP/1.1 200 OK)
and a content-type, followed by a blank line */
client.println("HTTP/1.1 200 OK");
client.println("Content-type:text/html");
client.println("Connection: close");
client.println();
// if the request does not contain 'GET /led/' req will be set to -1
int req = header.indexOf("GET /clk/");
if (req >= 0) {
SecVal = header.substring(9, 12).toInt(); // chars 9-11
MinVal = header.substring(12, 15).toInt(); // chars 12-14
HoueVal = header.substring(15, 18).toInt(); // chars 15-18
// parsed Values
Serial.print("watch: ");
Serial.print(HoueVal);
Serial.print(" ");
Serial.print(MinVal);
Serial.print(" ");
Serial.println(SecVal);
}
// displaying HTML webpage
client.println("<!DOCTYPE html><html>");
client.println("<head><title>wemos infinity clock</title></head>");
client.println("<body>");
client.print("<p>clk: ");
client.print(SecVal);
client.print(" ");
client.print(MinVal);
client.print(" ");
client.print(HoueVal);
client.println("</p>");
client.println("</body>");
client.println("</html>");
client.println(); // http response ends with blank line
break;
} else currentLine == "";
} else if (c != '\r') { // if you got anything else but a carriage return character,
currentLine += c; // add it to the end of the currentLine
}
}
}
// Ends connection and clears the header
header = "";
client.stop();
Serial.println("Client disconnected.");
Serial.println("");
}
}
my app block:
my error: