Adding AutoConnect To The Network Time Project

Online Weather Widget Using ESP8266
In a recent post, we learned about the AutoConnect feature for the ESP32/ESP8266 boards and one of the questions asked was about adding it to existing sketches. In this post, we will learn how to do just that and we will use the network time project as an example.

Since there is a lot of code that needs to be copied over, I would recommend watching the video to learn more as it’s much more efficient to watch it in action than read about it.

Step 1: Download the Sketches

You will need to download and obtain two sketches as we will be using them for this project. Start by download the network time project sketch (E12) from the following link: https://www.bitsnblobs.com/wp-content/media/fw/diy/diy-e12.zip

Extract the file and rename it to E16 as that will be the final sketch for this project.
Next, download the AutoConnect sketch (E13) using the following link: https://www.bitsnblobs.com/wp-content/media/fw/diy/diy-e13.zip

Extract this file too and open both sketches in the Arduino IDE.

Step 2: Update the Sketch

Now, we need to copy over some code from the AutoConnect sketch to the new sketch (E16). Please watch the video to follow through the steps or else you can download the final sketch using the link at the bottom of this post.

Step 3: Upload and Test

Upload the sketch to the board using the settings mentioned in the sketch. If the network credentials were previously stored in the flash, then the board will automatically connect to the WiFi network. If not, then you will need to connect to the access point and configure the network, just like we did in the AutoConnect video. Everything else is the same so please refer to the original post to learn how to use the AutoConnect library, if needed.

Link to original post: https://www.instructables.com/id/Using-WiFi-AutoConnect-With-ESP8266ESP32-Boards/