Ruddog icon

Disappearing WiFi connection

Ruddog | PRO | 01/04/18 02:46:54 AM UTC | 0 ⭐ | 425 👁️ | Never ⏰ | []
C++ |

1.21 KB

|

None

|

0 👍

/

0 👎

/////////////////////////////////
// Generated with a lot of love//
// with TUNIOT FOR ESP8266     //
// Website: Easycoding.tn      //
/////////////////////////////////
#include <ESP8266WiFi.h>
 
IPAddress staticIP753_20(192,168,1,2);
IPAddress gateway753_20(192,168,1,1);
IPAddress subnet753_20(255,255,255,0);
 
WiFiServer server(80);
 
void setup()
{
  Serial.begin(115200);
    WiFi.disconnect();
  delay(3000);
  Serial.println("START");
   WiFi.begin("xxxxxx","xxxxxxx");
  while ((!(WiFi.status() == WL_CONNECTED))){
    delay(300);
    Serial.print("..");
 
  }
  Serial.println("Connected");
  WiFi.config(staticIP753_20, gateway753_20, subnet753_20);
  Serial.println("Your IP is");
  Serial.println((WiFi.localIP()));
  server.begin();
 
}
 
 
void loop()
{
 
    WiFiClient client = server.available();
    if (!client) { return; }
    while(!client.available()){  delay(1); }
    client.flush();
    client.println("HTTP/1.1 200 OK");
    client.println("Content-Type: text/html");
    client.println("");
    client.println("<!DOCTYPE HTML>");
    client.println("<html>");
    client.println(analogRead(A0));
    client.println("</html>");
    client.stop();
    delay(1);
 
}

Comments