or use this for auto generated name ESP + ChipID and goes into a blocking loop awaiting configuration if it does not connect it starts an access point with the specified name fetches ssid and pass from eeprom and tries to connect Uncomment and run it once, if you want to erase all the stored information Once its business is done, there is no need to keep it around Initialize the output variables as outputs Auxiliar variables to store the current output state
Here’s the code that you need to upload to your ESP8266: /*********
Having the ESP8266 add-on for the Arduino IDE installed ( How to Install the ESP8266 Board in Arduino IDE), go to Tools and select “ESP-12E” (or choose the development board that you’re using). This first example is based on the ESP8266 Web Server post, where you build a web server with an ESP8266 to control two outputs (watch the video tutorial below).įor Example #1 we’ll use the previous project, but instead of hard-coding the SSID and password, you’ll be able to configure it with the WiFiManager library. Learn more how to Decode and Encode JSON with Arduino or ESP8266 using the Arduino JSON Library.Įxample #1 – WiFiManager with ESP8266: Autoconnect Example
Click here to download the ArduinoJSON library.Move the WiFiManager folder to your Arduino IDE installation libraries folder.Rename your folder from WiFiManager-master to WiFiManager.zip folder and you should get WiFiManager-master folder Click here to download the WiFiManager library.You also need to install the WiFiManager Library and ArduinoJSON Library. How to Install the ESP8266 Board in Arduino IDE.Getting Started Guide for the ESP8266 WiFi Module.Example #1 – Autoconnect: Web Server Exampleīefore proceeding with this tutorial we recommend reading the following resources:.This blog post illustrates two different use cases for the WiFiManager library: Otherwise, it will be set up as an Access Point. If it establishes a connection, the process is completed successfully.
Once a new SSID and password is set, the ESP reboots and tries to connect.After establishing a connection with the AutoConnectAP, you can go to the default IP address 192.168.4.1 to open a web page that allows you to configure your SSID and password.Using any Wi-Fi enabled device with a browser, connect to the newly created Access Point (default name AutoConnectAP).