forked from db4linq/lua
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcoms.lua
More file actions
28 lines (28 loc) · 959 Bytes
/
coms.lua
File metadata and controls
28 lines (28 loc) · 959 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
ssid = 'Comscicafe'
pwd = 'ArteTalento'
print("set up wifi mode")
wifi.setmode(wifi.STATION)
wifi.sta.config(ssid, pwd)
wifi.sta.connect()
cnt = 0
tmr.alarm(0, 1000, 1, function()
if (wifi.sta.getip() == nil) and (cnt < 200) then
print("IP unavaiable, Waiting...")
cnt = cnt + 1
else
tmr.stop(0)
if (cnt < 20) then
print("Config done, IP is "..wifi.sta.getip())
tmr.alarm(0, 2000, 1, function()
tmr.stop(0)
print("WIFI connected...")
dofile('tcp_client_temp.lc')
--dofile("iothink_relay.lc")
-- dofile("sample_http3.lua")
--dofile("iothink_weather.lc")
end)
else
print("Wifi setup time more than 10s, Please verify wifi.sta.config() function. Then re-download the file.")
end
end
end)