nimm mal den Quelltext:

Code:
#include <ESP8266WiFi.h>
//#include <ESP8266WebServer.h>
//#include <FS.h> // muss vor <detail\RequestHandlersImpl.h> stehen
//#include <detail\RequestHandlersImpl.h>


String ssid = "...";
String password = "...";


//ESP8266WebServer webserver(80); // Webserver-Instanz f�r Port 80 erstellen
WiFiServer server(80);




void setup()
{
  Serial.begin(115200);
  Serial.println();


  Serial.println("Connecting to " + ssid);
  WiFi.mode(WIFI_STA);
  WiFi.begin(ssid.c_str(), password.c_str());
  WiFi.config(IPAddress(xxx,xxx,xxx,xx), IPAddress(xxx,xxx,xxx,xxx), IPAddress(xxx,xxx,xxx,xxx), IPAddress(xxx,xxx,xxx,xxx));
  
  //WiFi.begin(ssid, password);
  while (WiFi.status() != WL_CONNECTED)
  {
    delay(500);
    Serial.print(".");
  }
  Serial.println(" connected");


  server.begin();
  Serial.printf("Web server started, open %s in a web browser\n", WiFi.localIP().toString().c_str());
}




// prepare a web page to be send to a client (web browser)
String prepareHtmlPage()
{
  String htmlPage =
     String("HTTP/1.1 200 OK\r\n") +
            "Content-Length: 44\r\n"+
            "Content-Type: text/html\r\n" +
            "Connection: close\r\n" +  // the connection will be closed after completion of the response
            "Refresh: 5\r\n" +  // refresh the page automatically every 5 sec
            "\r\n" +
            "<!DOCTYPE html>" +
            "<html>" +
            "Analog input:  " + String(analogRead(A0)) +
            "</html>" +
            "\r\n";
  return htmlPage;
}


void loop()
{
  WiFiClient client = server.available();
  // wait for a client (web browser) to connect
  if (client)
  {
    Serial.println("\n[Client connected]");
    while (client.connected())
    {
      // read line by line what the client (web browser) is requesting
      if (client.available())
      {
        String line = client.readStringUntil('\r');


        Serial.print(line);
        // wait for end of client's request, that is marked with an empty line
        if (line.length() == 1 && line[0] == '\n')
        {
          client.println(prepareHtmlPage());
          delay(100); // give the web browser time to receive the data
          // close the connection:
          client.stop();
          Serial.println("[Client disonnected]");
          break;
        }
      }
    }
  }
}