/* 17-8-2019 werkt met D1 MINI PRO WEMOS Vast IP adress Rondjes als knoppen Opmerking: instellen Arduino software Instellen Arduino -> Hulpmiddelen -> Board = D1 MINI PRO WEMOS Staat hij er niet bij dan Bestand -> Voorkeuren -> Additionele Bordenbeheer URLs = http://arduino.esp8266.com/stable/package_esp8266com_index.json */ #include const char *ssid = "XXX"; const char *pass = "XXXXXXXX"; // Update these with values suitable for your network. IPAddress ip(192, 168, 0, 128); //Node static IP IPAddress gateway(192, 168, 0, 1); IPAddress subnet(255, 255, 255, 0); float temperature, humidity, pressure, altitude; String SendHTML(float temperature,float humidity,float pressure,float altitude){ String ptr = ""; ptr +=""; ptr +=" "; ptr +=" "; ptr +=" "; ptr +=" Konva Circle Demo"; ptr +=" "; ptr +=" "; ptr +=" "; ptr +="
"; ptr +=" "; ptr +=" "; ptr +=""; return ptr; } WiFiServer server(80); void setup() { //Serial.begin(115200); delay(10); WiFi.begin(ssid, pass); WiFi.config(ip, gateway, subnet); //Wifi connection while (WiFi.status() != WL_CONNECTED) { delay(500); //serial.print("."); } //serial.println(""); //serial.print("WiFi connected, using IP address: "); //serial.println(WiFi.localIP()); //serial.print("Connecting to "); //serial.println(ssid); // Start the server server.begin(); //serial.println("Server started"); temperature = 1; humidity = 2; pressure = 3; altitude = 4; } void loop() { // Check if a client has connected WiFiClient client = server.available(); if (!client) { return; } // Wait until the client sends some data //serial.println("new client"); while (!client.available()) { delay(1); } // Return the response client.println("HTTP/1.1 200 OK"); client.println("Content-Type: text/html"); client.println(""); // do not forget this one client.println(""); client.println(""); client.println(""); client.println(SendHTML(temperature,humidity,pressure,altitude)); // delay(1); //serial.println("Client disonnected"); //serial.println(""); }