20 lines
551 B
Lua
20 lines
551 B
Lua
-- Tell the chip to connect to the access point
|
|
wifi.setmode(wifi.STATION)
|
|
print('set mode=STATION (mode='..wifi.getmode()..')')
|
|
print('MAC: ',wifi.sta.getmac())
|
|
print('chip: ',node.chipid())
|
|
print('heap: ',node.heap())
|
|
wifi.sta.config("Internet","")
|
|
|
|
tmr.alarm(0, 3000, 1, function()
|
|
if wifi.sta.getip() == nil then
|
|
print("Connecting to AP...")
|
|
else
|
|
tmr.stop(0)
|
|
print('IP: ',wifi.sta.getip())
|
|
-- Uncomment to automatically start the server in port 80
|
|
-- dofile("httpserver.lc")(80)
|
|
end
|
|
end)
|
|
|