ESP01 STM32 Nucleo statisch Webserver

Dependencies:   LCD_i2c_GSOE ESP8266WebserverGSOE

Revision:
6:5353c5484d58
Parent:
5:b4ae03006c7d
Child:
7:7c2ab1322fb2
diff -r b4ae03006c7d -r 5353c5484d58 main.cpp
--- a/main.cpp	Fri Jul 23 13:09:44 2021 +0000
+++ b/main.cpp	Mon Jul 26 06:41:11 2021 +0000
@@ -17,35 +17,14 @@
 #include "mbed.h"
 #include "ESP8266Webserver.h"
 #include "LCD.h"
-//#include "string"
 
-#include <string>
-
-
-
-
-PortOut diag(PortC,0xFF);
 lcd myLCD;
 ESP8266Webserver myWebserver;
-AnalogIn poti(PA_0);
-DigitalIn taste(PA_1);
-
-string webpage;
 
 string getRootPage()
 {
-
+      string webpage;
       webpage="<!DOCTYPE html>\n";
-      //Javascript
-      webpage+="<script type=\"text/javascript\">";
-      webpage+="var x;";
-      webpage+="function z(){location.assign(\"http://";
-      webpage+=myWebserver.gibIP();
-      webpage+="\");}";
-      webpage+="function sT(){x=setInterval(z,5000);}";
-      webpage+="function spT(){clearInterval(x);}";
-      webpage+="onload=sT();";
-      webpage+="</script>\n";
       //HTML
       webpage+="<html>\n";
       webpage+="<head>\n";
@@ -53,71 +32,18 @@
       webpage+="</head>\n";
       webpage+="<body>\n";
       webpage+="<h1>WIFI mit STM32 ESP01</h1>\n";
-      webpage+="<p>Aufrufe:";
-      webpage+=to_string(myWebserver.Aufrufe);
-      webpage+="</p>\n"; 
-      webpage+="<p>Poti:";
-      webpage+=to_string(poti);
-      webpage+="</p>\n"; 
-      
-      webpage+="<p>Taste PA_1:";
-      webpage+=to_string(taste);
-      webpage+="</p>\n"; 
-      
-      webpage+="<form>\n";
-      webpage+="<label for=\"Suchbegriff\">Suchbegriff</label>\n";
-      webpage+="<input id=\"Suchbegriff\" name=\"Suchbegriff\">\n";
-      webpage+="<label for=\"checkmich\">check mich:</label>\n";
-      webpage+="<input type=\"checkbox\" id=\"checkmich\" name=\"checkmich\">\n";
-      webpage+="<button>finden</button>\n";
-      webpage+="</form>\n";
-      webpage+="<H2>LED On/Off </H2>\n";
-      webpage+="<a href=\"ledAn\"><button>ON</button></a>\n";      
-      webpage+="<a href=\"ledaus\"><button>OFF</button></a>\n";
-      webpage+="</body>\n";
-      webpage+="</html>\n";
-  
       return webpage;
-
 }
 
 
 void testfunc()
 {
-    diag=diag|0x80;
-    
-    myWebserver.send(200,"text/html",getRootPage());
-}
-
-void testfunc2()
-{
-    diag=0x40;
-    myWebserver.send(200,"text/html",getRootPage());
-}
-void testfunc3()
-{
-    diag=0x20;
     myWebserver.send(200,"text/html",getRootPage());
 }
 
-void testfunc4()
-{
-    diag=diag|0x10;
-    myLCD.clear();
-    myLCD.cursorpos(0);
-    myLCD.printf("%s",myWebserver.gibWert("Suchbegriff"));
-    myLCD.cursorpos(0x40);
-    myLCD.printf("%s",myWebserver.gibWert("checkmich"));
-    myWebserver.send(200,"text/html",getRootPage());
-}
 
 int main()
-{
-    taste.mode(PullDown);
-    
-    myWebserver.on("Suchbegriff",&testfunc4);
-    myWebserver.on("ledaus",&testfunc2);
-    myWebserver.on("ledAn",&testfunc3);
+{  
     myWebserver.on("/",&testfunc);
 
     myWebserver.begin();
@@ -126,8 +52,6 @@
     myLCD.cursorpos(0);
     myLCD.printf("%s",myWebserver.gibIP());
     
-
-
     while(1)
     {
          myWebserver.handleClient();