 
 void loop()
 {
-  char buff[64];
-  int len = 64;
+  if (WiFi.ready())
+  {
+    char buff[64];
+    int len = 64;
 
-  webserver.processConnection(buff, &len);
+    webserver.processConnection(buff, &len);
+  }
 }

  switchPin(D2, LOW);
  switchPin(D3, LOW);

  webserver.setDefaultCommand(&helloCmd);

  webserver.addCommand("index.html", &helloCmd);


#define PREFIX ""
WebServer webserver(PREFIX, 80);

SYSTEM_MODE(SEMI_AUTOMATIC);

void helloCmd(WebServer &server, WebServer::ConnectionType type, char *, bool)
{
