User manual
004
if (esp8266.find("+IPD,"))
005
{
006
debug("Incoming Request");
007
int connectionId = esp8266.parseInt();
008
009
if (esp8266.findUntil("LED","\n")) digitalWrite(LED, !digitalRead(LED));
010
011
String webpage = "<h1>Hello World!</h1>Open [IP]/LED to Toggle LED on D9";
012
013
if (sendCom("AT+CIPSEND=" + String(connectionId) + "," + String(webpage.length()),
">"))
014
{
015
sendCom(webpage,"SEND OK");
016
sendCom("AT+CIPCLOSE=" + String(connectionId),"OK");
017
debug("Send and Close");
018
}
019
}
020
}
021
}
To start the web server, you can use a simple function again. It is called con-
figTCPServer(). This is simply what you entered manually before. The loop-routine
waits for inbound data. When these data contain »LED«, the LED is toggled. The
routine does not care about where »LED« is placed. Therefore, the command in
the submitted URL is legitimate. In this experiment, the website is in the webpage-
variable and contains the following text:
001
<h1>Hello World!</h1>
002
Open [IP]/LED to Toggle LED on D9
<h1> is an instruction to the browser to display the text until </h1> as a headline