Step 1. Upload firmware
Local Web server ESP12E code
#include <ESP8266WiFi.h> #include <WiFiClient.h> #include <ESP8266WebServer.h> #include <ESP8266mDNS.h> MDNSResponder mdns; ESP8266WebServer server(80); String webPage; const char* ssid = "NguyenTuong"; //wifi name const char* password = "123456789"; //wifi password void setup() { pinMode(16, OUTPUT); //led pin 16 webPage += "<h1>ESP8266 Web Server</h1><p>Socket #1 "; webPage += "<a href=\"socket1On\"><button>ON</button></a> "; webPage += "<a href=\"socket1Off\"><button>OFF</button></a></p>"; Serial.begin(74880); delay(100); Serial.println(); Serial.println(); Serial.print("Connecting to "); Serial.println(ssid); WiFi.begin(ssid, password); while (WiFi.status() != WL_CONNECTED) { delay(500); Serial.print("."); } Serial.println(""); Serial.println("WiFi connected"); Serial.println("IP address: "); Serial.println(WiFi.localIP()); if (mdns.begin("esp8266", WiFi.localIP())) Serial.println("MDNS responder started"); server.on("/", [](){ server.send(200, "text/html", webPage); }); server.on("/socket1On", [](){ server.send(200, "text/html", webPage); // Turn off LED digitalWrite(16, HIGH); delay(1000); }); server.on("/socket1Off", [](){ server.send(200, "text/html", webPage); //Turn on LED digitalWrite(16, LOW); delay(1000); }); server.begin(); Serial.println("HTTP server started"); } void loop() { server.handleClient(); }
This case, ESP12E is programmed by Arduino IDE. To know to program, please visit this article Link here
Step 2. Test
After load firmware successful, change ESP12E to RUN mode, open Monitor screen, result will show immediately as:
Now we can use mobile phone, or computer access to Local web by typing address 192.168.1.98 to web browser. A local web server will be shown. From this, we can turn ON or OFF LED on GPIO16
An author must have a vast knowledge of vocabulary. The dictionary of a writer must be full of new english vocabulary to make their work more attractive. Use of new words makes their work more valuable and graceful.
ReplyDeleteQNAP TS X51 Series
Thanks for your sharing
ReplyDeletePretty projects and great idea,Thank you for the tutorial and for sharing !
ReplyDeleteหนังออนไลน์
Great Article
ReplyDeleteInternet of Things Final Year Project
Final Year Project Centers in Chennai