The hard code credential in lua scripts worked successfully. But I have tried, and could not connect to wifi with uid/pass read from file stored in wifimcu. Please check this!
init.lua content :
cfg={}
if file.open("info.lua","r") then
cfg.ssid=file.readline()
cfg.pwd=file.readline()
file.close()
if cfg.ssid ~= nil and cfg.pwd ~= nil then
print("Start connect to AP :")
print("ssid : " .. cfg.ssid)
print("pwd : " .. cfg.pwd)
wifi.startsta(cfg);
cfg = nil
else
tmr.stop(1)
print("start AP mode to config credential")
end
end
Hello,
The hard code credential in lua scripts worked successfully. But I have tried, and could not connect to wifi with uid/pass read from file stored in wifimcu. Please check this!
init.lua content : cfg={} if file.open("info.lua","r") then cfg.ssid=file.readline() cfg.pwd=file.readline() file.close() if cfg.ssid ~= nil and cfg.pwd ~= nil then print("Start connect to AP :") print("ssid : " .. cfg.ssid) print("pwd : " .. cfg.pwd) wifi.startsta(cfg); cfg = nil else tmr.stop(1) print("start AP mode to config credential") end end
info.lua content : username password