init.lua 542 B

1234567891011121314151617181920212223
  1. -- Tell the chip to connect to the access point
  2. print('Welcome')
  3. wifi.setmode(wifi.STATION)
  4. print('set mode=STATION (mode='..wifi.getmode()..')')
  5. print('MAC: ',wifi.sta.getmac())
  6. print('chip: ',node.chipid())
  7. print('heap: ',node.heap())
  8. wifi.sta.config("Internet","")
  9. -- Wait until WiFi connection is established
  10. tmr.alarm(0, 2000, 1, function()
  11. if wifi.sta.getip() == nil then
  12. print("Connecting to AP...")
  13. else
  14. print('IP: ',wifi.sta.getip())
  15. tmr.stop(0)
  16. end
  17. end)
  18. --dofile("garage.lua")