Install the WiFiManager Library from the Arduino Library Manager or get it from Github (Which is worth checking out anyways as the Readme documentation is really good)

The library comes with a good few examples, the basic one being AutoConnect.ino, which is a good place to start, but basically you need to do the following

1) Once installed, you can add the following headers to your sketch:

#include

#include

#include <WiFiManager.h>

2) Replace the WiFi connection code in your setup with the following two lines:

WiFiManager wifiManager;

wifiManager.autoConnect("AutoConnectAP");

And that's it! As I mentioned it is really simple to add this to your sketches, but it makes them much more flexible.

Hopefully you find this useful and as always if you have any questions please ask!

Thanks,

Brian