parent
669ce27c59
commit
0a6b53ae88
@ -0,0 +1,49 @@
|
|||||||
|
|
||||||
|
#include <ESP8266WebServer.h>
|
||||||
|
#include <WiFiClient.h>
|
||||||
|
#include <ESP8266WiFi.h>
|
||||||
|
|
||||||
|
const char* ssid = "mathematics";
|
||||||
|
const char* password = "fzbyj8r7pdEk";
|
||||||
|
|
||||||
|
ESP8266WebServer server(7000);
|
||||||
|
|
||||||
|
String page = "";
|
||||||
|
String txt = "";
|
||||||
|
|
||||||
|
void setup() {
|
||||||
|
|
||||||
|
delay(1000);
|
||||||
|
Serial.begin(115200);
|
||||||
|
WiFi.begin(ssid, password);
|
||||||
|
Serial.println("");
|
||||||
|
|
||||||
|
// wait for connection
|
||||||
|
while (WiFi.status() != WL_CONNECTED) {
|
||||||
|
delay(500);
|
||||||
|
Serial.print(".");
|
||||||
|
}
|
||||||
|
Serial.print("connected to ");
|
||||||
|
Serial.println(ssid);
|
||||||
|
Serial.print("ip: ");
|
||||||
|
Serial.println(WiFi.localIP());
|
||||||
|
server.on("/", []() {
|
||||||
|
page = "<h1>hi</h1>" + String(txt) + 1;
|
||||||
|
server.send(200, "text/html", page);
|
||||||
|
});
|
||||||
|
|
||||||
|
server.begin();
|
||||||
|
Serial.println("started");
|
||||||
|
}
|
||||||
|
|
||||||
|
void loop() {
|
||||||
|
if (Serial.available() > 0) {
|
||||||
|
String txt = Serial.readStringUntil('\n');
|
||||||
|
Serial.println(txt);
|
||||||
|
Serial.println(page);
|
||||||
|
}
|
||||||
|
|
||||||
|
server.handleClient();
|
||||||
|
// Serial.println("ip: ");
|
||||||
|
|
||||||
|
}
|
||||||
Loading…
Reference in new issue