Webserver mit STM32F103C8T Mini (BluePill) und ESP-01

Dependencies:   LCD_i2c_GSOE ESP8266WebserverGSOE

Revision:
6:47d69b87b1ac
Parent:
5:b4ae03006c7d
Child:
8:0c96d061f374
diff -r b4ae03006c7d -r 47d69b87b1ac main.cpp
--- a/main.cpp	Fri Jul 23 13:09:44 2021 +0000
+++ b/main.cpp	Tue Jul 27 10:01:00 2021 +0000
@@ -17,12 +17,6 @@
 #include "mbed.h"
 #include "ESP8266Webserver.h"
 #include "LCD.h"
-//#include "string"
-
-#include <string>
-
-
-
 
 PortOut diag(PortC,0xFF);
 lcd myLCD;
@@ -30,18 +24,16 @@
 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+="<script type=\"text/javascript\">\n";
       webpage+="var x;";
-      webpage+="function z(){location.assign(\"http://";
-      webpage+=myWebserver.gibIP();
-      webpage+="\");}";
+      webpage+="function z(){location.assign(\"http://"+(string)(myWebserver.gibIP())+"\");}";
       webpage+="function sT(){x=setInterval(z,5000);}";
       webpage+="function spT(){clearInterval(x);}";
       webpage+="onload=sT();";
@@ -53,17 +45,10 @@
       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+="<p>Aufrufe:"+to_string(myWebserver.Aufrufe)+"</p>\n"; 
+      webpage+="<p>Poti:"+to_string(poti)+"</p>\n"; 
+      webpage+="<p>Taste PA_1:"+to_string(taste)+"</p>\n"; 
+      //Formular
       webpage+="<form>\n";
       webpage+="<label for=\"Suchbegriff\">Suchbegriff</label>\n";
       webpage+="<input id=\"Suchbegriff\" name=\"Suchbegriff\">\n";
@@ -71,6 +56,7 @@
       webpage+="<input type=\"checkbox\" id=\"checkmich\" name=\"checkmich\">\n";
       webpage+="<button>finden</button>\n";
       webpage+="</form>\n";
+      //Buttons
       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";