Post your best Lua script examples here

User avatar
By Rob White
#17614 I have found a webserver script on Random Nerd Tutorials website that works very well, but I want to be able to host this webserver on the ESP Soft AP mode. My project is an Automotive one and there will be no router and network to connect to. Rui Santos has added some script in the comments of his page regarding using this as a Soft AP mode, but this didn't work for me. Does anyone here use the Soft AP mode and can you help with this configuration?

http://randomnerdtutorials.com/esp8266-web-server/
User avatar
By Rob White
#17659 Well, as I said in the post, Rui Santos of Random Nerd posted in the comments an answer to someone with a code to replace to enable his webserver to be accessed in softap mode. The original code used this code for station mode setup: wifi.setmode(wifi.STATION)
wifi.sta.config ( "SSID" , "password" )

And Rui said to replace it with this code:
wifi.setmode(wifi.SOFTAP);
wifi.ap.config({ssid=”test”,pwd=”12345678″});

But after doing that I was able to open the softap and even connect to it, but unable to reach the webserver and view the page.

Thanks for replying,
Rob.
User avatar
By j0hncc
#17669 After connecting to the ESP wifi AP, what address did you put in your browser, 192.168.1.4? I believe that is the default, but if it has been reconfigured it could be something else. Can you ping it?

Or you could reset it explicitly in your init code with
Code: Select all cfg =
  {
    ip="192.168.1.4",
    netmask="255.255.255.0",
    gateway="192.168.1.4"
  }
  wifi.ap.setip(cfg)


HTH,
John