Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --wifi.sta.autoconnect(1)
- i = 0
- --print(wifi.sta.getip())
- dofile("example.lua")
- wifi.setmode(wifi.STATION)
- wifi.sta.config("tp-link","00000000")
- wifi.sta.autoconnect(1)
- --gpio.mode(2, gpio.OUTPUT)
- tmr.register(1, 1000, 1, function()
- print(wifi.sta.getip())
- if wifi.sta.getip() == nil then
- print("Connecting...")
- --wifi.sta.connect();
- i = i+1
- if (i>10) then
- tmr.stop(1)
- i = 0
- print("Failed")
- end
- else
- --gpio.write(2, gpio.HIGH)
- getip=wifi.sta.getip()
- i = 0;
- print("Connected, IP is "..getip.."\n\r")
- tmr.stop(1)
- end
- end)
- tmr.start(1)
- --collectgarbage()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement