Install the WiFiManager Library from the Arduino Library Manager or get it from Github (Which is price testing anyhow because the Readme documentation is absolutely good)
The library comes with a superb few examples, the fundamental one being AutoConnect.ino, which is an efficient place to start out, however mainly you’ll want to do the next
1) Once put in, you may add the next headers to your sketch:
2) Replace the WiFi connection code in your setup with the next two traces:
And that is it! As I discussed it’s actually easy so as to add this to your sketches, nevertheless it makes them way more versatile.
Hopefully you discover this handy and as all the time in case you have any questions please ask!