Using the WiFiManager library

Until now the SSID and password for connecting the ESP8266 to the Wi-Fi network have been hardcoded in the sketch using these lines:

const char* ssid = "YOUR_WIFI_SSID"; const char* password = "YOUR_WIFI_PASSWORD";

To stop using the hardcoded values we need to first start the ESP8266 in AP mode and expose the user as a web interface served by an embedded web server hosted inside the ESP8266.

We will learn how to use the WiFiManager library to expose a configuration web page; we will take the data and save it to a SPIFFS like we did in the previous chapter and use it to start our module in station mode and connect to an MQTT server.

If you didn't install the WiFiManager library in Chapter 1, Getting Started with ...

Get ESP8266 Home Automation Projects now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.