Roboterfahrzeug Arexx Webserver
Dependencies: LCD_i2c_GSOE ESP8266WebserverGSOE
Revision 14:22b43ffe4bae, committed 2021-08-09
- Comitter:
- jack1930
- Date:
- Mon Aug 09 10:32:39 2021 +0000
- Parent:
- 13:afede152ba79
- Commit message:
- Roboterfahrzeug
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Sat Aug 07 09:30:20 2021 +0000 +++ b/main.cpp Mon Aug 09 10:32:39 2021 +0000 @@ -18,10 +18,16 @@ #include "ESP8266Webserver.h" #include "LCD.h" +#define VOR 0b1010 +#define RUECK 0b0101 +#define LINKS 0b1001 +#define RECHTS 0b0110 +#define STOP 0b0000 + lcd myLCD; ESP8266Webserver myWebserver; AnalogIn poti(PA_0); -DigitalOut myled(PC_0); +PortOut roboter(PortC,0xFF); string getRootPage() { string webpage; @@ -33,9 +39,11 @@ webpage+="</head>"; 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+="<table>"; + webpage+="<tr> <td></td> <td><a href=\"vor\"><button>VOR</button></a></td> <td></td> </tr>"; + webpage+="<tr> <td><a href=\"links\"><button>LINKS</button></a></td> <td><a href=\"stop\"><button>STOP</button></a></td> <td><a href=\"rechts\"><button>RECHTS</button></a></td></tr>"; + webpage+="<tr> <td></td> <td><a href=\"rueck\"><button>RUECK</button></a></td> <td></td> </tr> "; + webpage+="</table>"; webpage+="</body>"; webpage+="</html>"; return webpage; @@ -47,21 +55,43 @@ myWebserver.send(200,"text/html",getRootPage()); } -void testfunc2() +void vor() { - myled=0; + roboter=VOR; + myWebserver.send(200,"text/html",getRootPage()); +} + +void rueck() +{ + roboter=RUECK; myWebserver.send(200,"text/html",getRootPage()); } -void testfunc3() +void links() +{ + roboter=LINKS; + myWebserver.send(200,"text/html",getRootPage()); +} + +void rechts() { - myled=1; + roboter=RECHTS; + myWebserver.send(200,"text/html",getRootPage()); +} + +void stop() +{ + roboter=STOP; myWebserver.send(200,"text/html",getRootPage()); } int main() { - myWebserver.on("ledAus",&testfunc2); - myWebserver.on("ledAn",&testfunc3); + myWebserver.on("vor",&vor); + myWebserver.on("rueck",&rueck); + myWebserver.on("links",&links); + myWebserver.on("rechts",&rechts); + myWebserver.on("stop",&stop); + myWebserver.on("/",&testfunc); myWebserver.begin(); myLCD.clear();