-#include <dummy.h>
+//#include <dummy.h>
 #include <ESP8266WiFi.h>
+#include <WiFiClient.h>
+#include <ESP8266WebServer.h>
 #include <PubSubClient.h>
-#include <ESP8266WebServer.h>
 #include <EEPROM.h>
 
 // Update these with values suitable for your network.

  EEPROM.begin(512);
  //pinMode(0, INPUT);
  pinMode(4, INPUT);
  WiFi.begin();
  delay(1000);
  Serial.println("");
  Serial.println("delay done");
  Serial.println(digitalRead(4));
   if (digitalRead(4)==false)
  { 
    Serial.println("button pressed at beginning");
    delay(250);
     if (digitalRead(4)==false)setupAP();
     while(1){server.handleClient();delay(10);}
    
  }
  else{
  Serial.println(""); 
  redEEPromRead();
  Serial.println("");
  Serial.print("point ID is: ");
  Serial.println(pointID);
  pinMode(BUILTIN_LED, OUTPUT);     // Initialize the BUILTIN_LED pin as an output  
  setup_wifi();
  client.setServer(mqtt_server, 1883);
  client.setCallback(callback);
  pinMode(0, INPUT);
  delay(1000);
  reconnect();}
  
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////
void loop() {

  if (!client.connected() && (WiFi.status() == WL_CONNECTED)) {
    Serial.println("rwwwiaiau");
    reconnect();
  }
 
  client.loop();
  
   if (digitalRead(0)==false)
  {
    Serial.println("button pressed");
    delay(250);
     if (digitalRead(0)==false)joinControlNet();
    
  }

   
}

        Serial.println("server received /");
        IPAddress ip = WiFi.softAPIP();
        String ipStr = String(ip[0]) + '.' + String(ip[1]) + '.' + String(ip[2]) + '.' + String(ip[3]);
        content = "<!DOCTYPE HTML>";
        content += "<html>";
        content += "<head> <meta charset='utf-8'> <meta http-equiv='X-UA-Compatible' content='IE=edge'> <title></title> <meta name='description' content=''> <meta name='viewport' content='width=device-width, initial-scale=1'> <link rel='stylesheet' href=''> </head>";
        content += "<style>";
        content += ".redInput {display: flex; justify-content: space-between; width:  60%; margin: .5rem;}";
        content += "input[type=submit]{background-color: #4CAF50; border: none; color: white; padding: 16px 32px; text-decoration: none; margin: 4px 2px; cursor: pointer;}";
        content += "</style>";
        content += "<body>";
        content += "<h2>Welcome to redDevice WiFi Setup at IP Address:";
        content += ipStr;
        content += "</h2>";
        content += "<h4>Please select your WiFi network and enter the pass key</h4>";
        content += "<form method='get' action='setting'>";
        content += st;
        content += "<div class='redInput'><label>Key: </label><input type='password' name='pass' length=64></div>";
        content += "<input type='submit' value='Enter'>";
        content += "</form>";
        content += "</body>";
        content += "</html>";
        server.send(200, "text/html", content);  
    });
