Closed mirmisbahali closed 2 years ago
Sorry, the webap_toggle_pin.lua example is working fine. It turns out that after connecting the nodemcu wifi I was typing the wrong IP address in the browser URL bar.
We can get the IP address by printing the result of wifi.ap.getip()
function.
Here is the code I've written to debug the problem:
wifi.setmode(wifi.SOFTAP)
wifi.ap.config({ ssid = "test", auth = wifi.OPEN})
srv = net.createServer(net.TCP)
print("Visit http://" .. wifi.ap.getip()) -- Get the IP address
srv:listen(80, function(conn)
print("connection made")
conn:on('receive', function(client, request)
client:send('<h1>hello world</h1>')
end)
conn:on("sent", function(c) c:close() end)
end)
I'm trying to create a web server while configuring the esp8266 module in
Soft Access Point mode
but the webap_toggle_pin.lua example is not working. Also, the tutorials available on the internet are showing how to create a web server while the esp8266 is set up inStation mode
but not inSoft Access Point mode
.