|
@@ -62,52 +62,10 @@ By default, ElegantOTA uses your chip id as a unique id for your esp chip on web
|
|
|
|
|
|
|
|
|
<br>
|
|
|
-<h2>ESP8266 Example</h2>
|
|
|
+<h2>Examples</h2>
|
|
|
+
|
|
|
+ Checkout code examples for ESP8266 and ESP32 in `examples` directory. [Click Here](https://github.com/ayushsharma82/ElegantOTA/tree/master/examples)
|
|
|
|
|
|
-```
|
|
|
-
|
|
|
-#include <ESP8266WiFi.h>
|
|
|
-#include <WiFiClient.h>
|
|
|
-#include <ESP8266WebServer.h>
|
|
|
-#include <ElegantOTA.h>
|
|
|
-
|
|
|
-const char* ssid = "........";
|
|
|
-const char* password = "........";
|
|
|
-
|
|
|
-ESP8266WebServer server(80);
|
|
|
-
|
|
|
-
|
|
|
-void setup(void) {
|
|
|
- Serial.begin(115200);
|
|
|
- WiFi.mode(WIFI_STA);
|
|
|
- WiFi.begin(ssid, password);
|
|
|
- Serial.println("");
|
|
|
-
|
|
|
- // Wait for connection
|
|
|
- while (WiFi.status() != WL_CONNECTED) {
|
|
|
- delay(500);
|
|
|
- Serial.print(".");
|
|
|
- }
|
|
|
- Serial.println("");
|
|
|
- Serial.print("Connected to ");
|
|
|
- Serial.println(ssid);
|
|
|
- Serial.print("IP address: ");
|
|
|
- Serial.println(WiFi.localIP());
|
|
|
-
|
|
|
- server.on("/", []() {
|
|
|
- server.send(200, "text/plain", "Hi! I am ESP8266.");
|
|
|
- });
|
|
|
-
|
|
|
- ElegantOTA.begin(&server); // Start ElegantOTA
|
|
|
- server.begin();
|
|
|
- Serial.println("HTTP server started");
|
|
|
-}
|
|
|
-
|
|
|
-void loop(void) {
|
|
|
- server.handleClient();
|
|
|
-}
|
|
|
-
|
|
|
-```
|
|
|
<br>
|
|
|
|
|
|
<h2>Contributions</h2>
|