#include <Duinoedu_Esp8266.h>

Duinoedu_Esp8266 MonEsp;
int push1;
ESP8266WebServer server ( 80 );

void setup()
{
  MonEsp.connect_STA_smart("Driss Tel","driss57000");
  pinMode( D4 , OUTPUT);
  server.on ( "/", handleRoot );
  server.begin();  
  Serial.println ( "HTTP server started" );
}

void handleRoot(){
  MonEsp.updateStringint(&server,"push1", push1);
  server.send ( 200, "text/html", getPage() );
  delay(10);
}

String getPage(){
#define PAGE_EXIST
  String  page = "<!DOCTYPE html><html><head><meta charset='ISO-8859-15'>";
  page += "<title>DUINOEDU - www.duinoedu.com</title></head>";
  page += MonEsp.addPhoneStyle();
  page += "<BODY onload='process()'>";
  page += MonEsp.javaslider();
  page += MonEsp.slider(0,0,"push1""");
  page += "</body>";
  page += "</html>";
  return page;
}

void loop()
{
#ifdef PAGE_EXIST
  server.handleClient();
  delay(10);
#endif
  digitalWrite(D2 , push1);
}
