ESP01 STM32 Nucleo statisch Webserver
Dependencies: LCD_i2c_GSOE ESP8266WebserverGSOE
main.cpp
00001 /* ATCmdParser usage example 00002 * Copyright (c) 2016 ARM Limited 00003 * 00004 * Licensed under the Apache License, Version 2.0 (the "License"); 00005 * you may not use this file except in compliance with the License. 00006 * You may obtain a copy of the License at 00007 * 00008 * http://www.apache.org/licenses/LICENSE-2.0 00009 * 00010 * Unless required by applicable law or agreed to in writing, software 00011 * distributed under the License is distributed on an "AS IS" BASIS, 00012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00013 * See the License for the specific language governing permissions and 00014 * limitations under the License. 00015 */ 00016 00017 #include "mbed.h" 00018 #include "ESP8266Webserver.h" 00019 #include "LCD.h" 00020 00021 lcd myLCD; 00022 ESP8266Webserver myWebserver; 00023 00024 string getRootPage() 00025 { 00026 string webpage; 00027 webpage="<!DOCTYPE html>"; 00028 //HTML 00029 webpage+="<html>"; 00030 webpage+="<head>"; 00031 webpage+="<title>STM32 HTTP</title>"; 00032 webpage+="</head>"; 00033 webpage+="<body>"; 00034 webpage+="<h1>WIFI mit STM32 ESP01</h1><br>"; 00035 webpage+="</body>"; 00036 webpage+="</html>"; 00037 return webpage; 00038 } 00039 00040 00041 void testfunc() 00042 { 00043 myWebserver.send(200,"text/html",getRootPage()); 00044 } 00045 00046 00047 int main() { 00048 myWebserver.on("/",&testfunc); 00049 myWebserver.begin(); 00050 myLCD.clear(); 00051 myLCD.cursorpos(0); 00052 myLCD.printf("%s",myWebserver.gibIP()); 00053 while(1) { 00054 myWebserver.handleClient(); 00055 } 00056 }
Generated on Fri Jul 29 2022 19:29:37 by
1.7.2