void data()
{
// put your main code here, to run repeatedly:
if(ESPserial.available()) // check if the esp is sending a message
{
if(ESPserial.find("+IPD,"))
{
delay(1000);
int connectionId = ESPserial.read()-48; // subtract 48 because the read() function returns
// the ASCII decimal value and 0 (the first decimal number) starts at 48
//Display.print(connectionId);
String cipSend = "AT+CIPSEND=";
cipSend += connectionId;
cipSend += ",";
cipSend +=webpage.length();
cipSend +="\r\n";
sendData(cipSend,1000,0);
sendData(webpage,1000,0);
//webpage="<h2>Open</h2>";
//cipSend = "AT+CIPSEND=";
//cipSend += connectionId;
//cipSend += ",";
//cipSend +=webpage.length();
//cipSend +="\r\n";
//sendData(cipSend,1000,0);
//sendData(webpage,1000,0);
String closeCommand = "AT+CIPCLOSE=";
closeCommand+=connectionId; // append connection id
closeCommand+="\r\n";
sendData(closeCommand,3000,0);
}
}
}
String sendData(String command, const int timeout, boolean debug)
{
String response = “”;
ESPserial.print(command); // send the read character to the esp8266
long int time = millis();
while( (time+timeout) > millis())
{
while(ESPserial.available())
{
// The esp has data so display its output to the serial window
char c = ESPserial.read(); // read the next character.
response+=c;
}
}
if(debug)
{
Serial.print(response);
}
return response;
}
this is a code to send some information to a web browser . i dont understand it .