How do I Save and Run a Compiled Program

I have a program which compiles, loads and runs on a NodeMCU.
It works - finds and logs into a network, and remembers the network credentials.

My problem is that I want to allow a user to reset he module, so that the module can learn about his network and store the new information.

I can do this (thanks to the Forum!) with a simple 1-line program: WiFi.disconnect();

I can do this by embedding the line into a program (including appropriate libraries), compiling and uploading it to the NodeMCU module. This all works fine.

However, I would like be able to compile the program, and then to provide the user with some simple way of using the resulting program which I'd like to supply on a USB stick, so that he does not have to go through all the fuss of loading the IDE, the Libraries, and compiling the program.

Any ideas?

You have a NODEMCU, which is a fabulous platform for browser-based applications. Provide a means (i.e. - a switch) to force the NODEMCU come up in AP mode, and create its own WiFi network with a known SSID and password. The user can then simply connect to with his phone, PC or tablet, and use a browser to make any necessary configuration setting changes to make the "normal" application do whatever it does. Think about how most any WiFi AP is configured when first taken out of the box.

Regards,
Ray L.

Thanks, Ray, for your thoughts.

However, my user will have his own network, and I'd like him to be able to use my device with his network.
I can do this with my own network; the first time allows the "new" module (using wifiManager.autoConnect(); ) to be "discovered" on my phone; logging on to my discovered network and inputting the network password.
Thereafter the module "remembers" my network and credentials. So far, so good.

I can then erase the network info with WiFi.disconnect(); and give it to my user to use on his network.

However, should he make a mistake, or care to change networks, I'd like to be able to let him wipe out the network credentials and start fresh again.

What I'm looking for is a simple way to allow him to do this.

Any further ideas?

Which is exactly what I described.... A simple switch on the board. When the switch is closed, the NODEMCU re-initializes, and comes up as an Access Point, with a canned SSID and password. The user connects to that canned SSID, using the canned password, then points a browser at the also canned IP address of the NODEMCU, which brings up a web page that lets the user enter HIS networks SSID and password. Those get stored in a FLASH file system on the NODEMCU. The switch is then opened, and the NODEMCU re-initializes again, and connects to the users network. It is, literally, a few lines of code, and a simple web page (HTML+CSS, and perhaps a few lines of Javascript).

Regards,
Ray L.

Connect a button to an available pin. In loop() put:

. if (buttonIsPressed)
    WiFi.disconnect();

Or put the code in setup() and tell the user to hold down the button and press "Reset" (or cycle power).

Thanks all!

Just FYI, I put it in the "setup" section, with a short countdown clock, so that if the user does nothing the system powers up normally, but if he hits the button on powerup it resets the network credentials.

This WiFiManager is tremendously powerful - once you get to know the "magic words"