Web Server not working with Soft AP Mode
Posted: Fri Mar 10, 2017 12:28 pm
I am just new to ESP8266. Need little help. I am trying to setup NODEMCU Amica 8266 as Soft AP and web server both. As soft AP, I am able to connect to ESP8266 but whenever I try to open the webpage, it shows the payload but Webpage doesn't open on the device connected.
I have used the following code :-
Kindly guide what is wrong I am doing?
I have used the following code :-
Code: Select all
print("Ready to start soft ap");
cfg={};
cfg.ssid="ESP8266";
cfg.pwd="myesp123";
wifi.ap.config(cfg);
cfg={}
cfg.ip="192.168.11.1";
cfg.netmask="255.255.255.0";
cfg.gateway="192.168.11.1";
wifi.ap.setip(cfg);
wifi.setmode(wifi.SOFTAP);
collectgarbage();
print("Soft AP started");
print("Heep:(bytes)"..node.heap());
print("MAC:"..wifi.ap.getmac());
print("IP:"..wifi.ap.getip());
srv=net.createServer(net.TCP)
srv:listen(80,function(conn)
conn:on("receive",function(conn,payload)
print(payload)
conn:send("<h1> Hello, NodeMcu.</h1>")
end)
end)
Kindly guide what is wrong I am doing?