User Tools

Site Tools


espautowificonfig

This is an old revision of the document!


//Updates: [[wifimanager|WiFiManager]] might be a better solution//

WiFi Auto Configuration

  • if SSID is not visible, have to manually connect to SSID: WIFIConfig with Password: 12345678
lib_deps = drmpf/ESPAutoWiFiConfig @ ^2.2.0
#include <ESPAutoWiFiConfig.h>
#include <ESP8266WiFi.h>
#include <ESP8266WebServer.h>

ESP8266WebServer server(80);
int ledPin = 2; 
// use ledPin = 2 for NodeMCU / ESP-01S (Blue led on GPIO2)
// use ledPin = 1 for ESP-01 (Blue led on TX (GPIO1), ESP-01 also has a Red power led)
bool highForLedOn = false; // need to make output low to turn ESP8266, ESP-01, ESP-01S  Led ON
size_t eepromOffset = 0;   // if you use EEPROM.begin(size) in your code add the size here so AutoWiFi data is written after your data

// ========== trivial webserver example =============
void notFound() {
  server.send(404, "text/plain", "Not found");
}

void handleRoot() {
  server.send(200, "text/html", "Link: <a href='update'>Firmware Update</a><br>");
}

void startWebServer() {
  server.on("/", handleRoot);
  server.onNotFound(notFound);
  server.begin();
}

void initializewificonfig()
{
    if (ESPAutoWiFiConfigSetup(ledPin, highForLedOn, eepromOffset))
    {           // check if we should start access point to configure WiFi settings
        return; // in config mode so skip rest of setup
    }
    startWebServer();
}
espautowificonfig.1760177339.txt.gz · Last modified: by jwan

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki