-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinit.lua
More file actions
29 lines (26 loc) · 777 Bytes
/
init.lua
File metadata and controls
29 lines (26 loc) · 777 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
29
--init.lua
wifi.setmode(wifi.STATION)
print('set mode=STATION (mode='..wifi.getmode()..')')
-- wifi config start
wifi.sta.config("SSID","PASSWORD")--modify accordingly
-- wifi config end
dofile("config.lua")
print("Config done.")
--print(wifi.sta.getip())
--next tmr chunk flashes the blue LED once at every 10 seconds showing that
--the program is running. If it bothers you delete it.
tmr.alarm(2,10000,1, function()
gpio.write(bluePin,gpio.HIGH)
tmr.delay(100000)
gpio.write(bluePin,gpio.LOW)
end)
tmr.alarm(0, 5000, 1, function()
ip = wifi.sta.getip()
if ip=="0.0.0.0" or ip==nil then
print("connecting to AP...")
else
tmr.stop(0)
print("IP = "..wifi.sta.getip())
dofile("googletime.lua")
end
end)