   server.send(200, "text/plain", "Hello. I am a mains relay. /on or /off");
   delay(100);
 }
- 
+
 void setup(void)
 {
   pinMode(relay, OUTPUT);
   pinMode(button, INPUT);
-  
-  Serial.begin(115200); 
 
-  
+  Serial.begin(115200);
+
+
   WiFi.begin(ssid, password);
   WiFi.config(ip, gateway, subnet);
   Serial.print("\n\r \n\rWorking to connect");

  Serial.println(ssid);
  Serial.print("IP address: ");
  Serial.println(WiFi.localIP());
   
  server.on("/", handle_root);
  
  server.on("/off", [](){  
    relayOff();
    webString = 'Off';
    server.send(200, "text/plain", webString);           
  });

  server.on("/on", [](){  
    relayOn();
    webString = 'On';
    server.send(200, "text/plain", webString);               
  });
  
  server.begin();
  Serial.println("HTTP server started");
}
 
void loop(void)
{
  server.handleClient();
  checkButton();
} 

void relayOn(){
  digitalWrite(relay, HIGH);

}

void checkButton(){

  int current = digitalRead(button);

  if (current == HIGH && temp != current){

    if (val == HIGH){
      relayOff();
    }

    if (val == LOW){
      relayOn();
    }

    temp = current;
  }

  if (current == LOW && temp != current){
    temp = current;
  }

}
