By Syed Owais Chishti
E-Lab


follow the instructions below


#include "ESP8266WiFi.h"
// use greater and less than signs sign instead of quotes above in library.
const char* ssid = "SSID";
//enter your ssid above in quotes
const char* password = "password";
//enter your password above in quotes. WiFiServer server(80); //to initiliase webserver at port 80.
void setup() {
Serial.begin(115200);
delay(10);
Serial.println(ssid);
WiFi.begin(ssid, password);//connecting to your router
while (WiFi.status() != WL_CONNECTED) {
delay(500);
}
server.begin();//initialise server
Serial.println(WiFi.localIP());
}
void loop() {
WiFiClient client = server.available();//if connected to server
client.println("ESP AVAILABLE");
if (!client) {//server should be client
return;
}
while(!client.available()){//if server is not connected then
delay(1);wait to connect
}
String request = client.readStringUntil('\r');
Serial.println(request);
client.flush();
client.println("HTTP/1.1 200 OK");
client.println("Content-Type: text/html");
client.println(""); // do not forget this one
delay(1);
// above 8 lines are server setup html commands. }