Webserver GSOE Slider PWM ESP01 STM32Nucleo L152RE

Dependencies:   LCD_i2c_GSOE ESP8266WebserverGSOE

Files at this revision

API Documentation at this revision

Comitter:
jack1930
Date:
Wed Aug 04 11:48:03 2021 +0000
Parent:
9:aadd57ea2033
Commit message:
Slider

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Tue Jul 27 10:05:54 2021 +0000
+++ b/main.cpp	Wed Aug 04 11:48:03 2021 +0000
@@ -20,6 +20,9 @@
 
 lcd myLCD;
 ESP8266Webserver myWebserver;
+PwmOut Motor(PC_7);
+int wert=5;
+string slider="50";
 
 string getRootPage()
 {
@@ -32,19 +35,33 @@
       webpage+="</head>";
       webpage+="<body>";
       webpage+="<h1>WIFI mit STM32 ESP01</h1><br>";
+      webpage+="<form>\n";
+      webpage+="<input type=\"range\" name=\"points\" min=\"0\" max=\"100\" value="+slider+">";
+      webpage+="<button>senden</button>\n";
+      webpage+="</form>\n";
       webpage+="</body>";
       webpage+="</html>";
       return webpage;
 }
 
-
 void testfunc()
 {
     myWebserver.send(200,"text/html",getRootPage());
 }
 
+void testfunc2()
+{
+    slider=myWebserver.gibWert("points");
+    Motor=stof(slider,NULL)/100;
+    myLCD.clear();
+    myLCD.cursorpos(0);
+    myLCD.printf("%s",slider.c_str());
+    myWebserver.send(200,"text/html",getRootPage());
+}
+
 
 int main() {  
+    myWebserver.on("points",&testfunc2);
     myWebserver.on("/",&testfunc);
     myWebserver.begin();    
     myLCD.clear();