ESP01 Webserver STM32 Steuerung

Dependencies:   LCD_i2c_GSOE ESP8266WebserverGSOE

Revision:
10:54b312c82e18
Parent:
7:40e19bb6820a
diff -r 40e19bb6820a -r 54b312c82e18 main.cpp
--- a/main.cpp	Mon Jul 26 08:48:24 2021 +0000
+++ b/main.cpp	Mon Jul 26 12:03:27 2021 +0000
@@ -21,6 +21,7 @@
 lcd myLCD;
 ESP8266Webserver myWebserver;
 AnalogIn poti(PA_0);
+DigitalOut myled(PC_0);
 string getRootPage()
 {
       string webpage;
@@ -33,6 +34,8 @@
       webpage+="<body>";
       webpage+="<h1>WIFI mit STM32 ESP01</h1>\n";
       webpage+="<p>Poti:"+to_string(poti)+"</p>\n"; 
+      webpage+="<a href=\"ledAn\"><button>ON</button></a>\n";      
+      webpage+="<a href=\"ledAus\"><button>OFF</button></a>\n";
       webpage+="</body>";
       webpage+="</html>";
       return webpage;
@@ -44,8 +47,21 @@
     myWebserver.send(200,"text/html",getRootPage());
 }
 
+void testfunc2()
+{
+    myled=0;
+    myWebserver.send(200,"text/html",getRootPage());
+}
+
+void testfunc3()
+{
+    myled=1;
+    myWebserver.send(200,"text/html",getRootPage());
+}
 
 int main() {  
+    myWebserver.on("ledAus",&testfunc2);
+    myWebserver.on("ledAn",&testfunc3);
     myWebserver.on("/",&testfunc);
     myWebserver.begin();    
     myLCD.clear();