Can't set SSID in AP Mode
Posted: Tue Mar 03, 2015 1:35 pm
Hey I got a serious problem, because I would like that the esp had a special SSID, but when I define that in the code and let the esp do it's magic it sets up a wifi with the SSID ESP_9BF5E5 and not the one I defined before. I need this working until thursday, because I am going to show that in front of an audience.
Here is my code:
init.lua
Here is my code:
init.lua
Code: Select all
--include
require('ds18b20')
--wifi settings
--cfg={}
--cfg.ssid="nodeduino"
--cfg.pwd=""
--setup wifi ap
wifi.setmode(wifi.SOFTAP)
--wifi.ap.config(cfg)
wifi.ap.config({ssid="NODEDUINO",pwd=""})
print(wifi.ap.getip())
--in/outpus
led = 4
gpio.mode(led, gpio.OUTPUT)
tempp = 3
ds18b20.setup(tempp)
--variables
--ledstat = 0
--get temperature & store
t1=ds18b20.read()
t1=ds18b20.read()
--main
srv=net.createServer(net.TCP)
srv:listen(80,function(conn)
conn:on("receive", function(client,request)
local buf = "";
local _, _, method, path, vars = string.find(request, "([A-Z]+) (.+)?(.+) HTTP");
if(method == nil)then
_, _, method, path = string.find(request, "([A-Z]+) (.+) HTTP");
end
local _GET = {}
if (vars ~= nil)then
for k, v in string.gmatch(vars, "(%w+)=(%w+)&*") do
_GET[k] = v
end
end
buf = buf.."<font size=\"12\">Nodeduino Beispiel</font>";
buf = buf.."<p><font size=\"7\">Temperatur: "..t1.."°C</font> </p>";
buf = buf.."<p><a href=\"?pin=temp\"><button style=\"width:400px;height:200px\"><font size=\"7\">Aktualisieren</font></button></a> </p>";
buf = buf.."<p><font size=\"7\">LED Status ändern:</font> </p>";
buf = buf.."<p><a href=\"?pin=ON\"><button style=\"width:400px;height:200px\"><font size=\"7\">An</font></button></a> <a href=\"?pin=OFF\"><button style=\"width:400px;height:200px\"><font size=\"7\">Aus</font></button></a></p>";
local _on,_off = "",""
if(_GET.pin == "temp")then
t1=ds18b20.read()
t1=ds18b20.read()
elseif(_GET.pin == "ON")then
gpio.write(led, gpio.HIGH);
elseif(_GET.pin == "OFF")then
gpio.write(led, gpio.LOW);
end
client:send(buf);
client:close();
collectgarbage();
end)
end)