rrezaii wrote:- When you power-cycle the module, it checks to see if has an AP IP address. If it doesn't, then it configures itself as an AP with a known SSID and password.
Brilliant, exactly what I had in mind. Intend to use your code into my webserver startupcode.
rrezaii wrote:- After the automatic reboot, we call another script: "onboardServer.lua". In this script, the module listen on port 80 and allows a browser (PC, iOS/Android device) to configure it by issuing the following http command
This allows you to use your phone to configure your ESP module with your home WIFI credentials by just using a browser.
I understand that you want the browser to configure you AP credentials. You should be able to modify this easily to do that.
I have a webserver running on the ESP now, serving several html pages. Now I can create another html page with a code similar to yours in it. This gives me nice headstart, thanks for that.
BTW : have a look at my webserver example. It (as always) "in progress", but is coming along nicely. Latest feature I added in is the execution of Lua code embedded in HTML pages, analog to PHP server-side code. The execution of a .lua file by clicking on a file.lua link also works. Last remaining issue to solve is getting the result of the Lua that is executed to be sent to the browser. The result is now printed to the serial console, but sending the string to the browser is giving me some headaches. It's probably "a little thing" for an experienced Lua programmer, not for me . If you have a tip for that?
webserver currently looks like this:
If you're interested, have a look at this (now longish) topic: