ayushsharma82 / ElegantOTA

OTA updates made slick and simple for everyone!
https://elegantota.pro
GNU Affero General Public License v3.0
646 stars 120 forks source link

Initial AP mode, then option for .bin URL #5

Closed danricho closed 5 years ago

danricho commented 5 years ago

If this could provide an AP mode initially to allow a user to set the Wifi credentials and .bin path, this firmware would be great to flash to an ESP prior to soldering (via a programming jig).

ayushsharma82 commented 5 years ago

ElegantOTA doesn't handle networking part. You can modify WiFi settings according to your need.. In your case:

#include <ESP8266WiFi.h>
#include <WiFiClient.h>
#include <ESP8266WebServer.h>
#include <ElegantOTA.h>

ESP8266WebServer server(80);

void setup(void) {
  Serial.begin(115200);
  WiFi.mode(WIFI_AP);
  WiFi.softAP("ElegantOTADevice", "");

  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();
}