init.lua 579 B

1234567891011121314151617181920
  1. -- Tell the chip to connect to the access point
  2. wifi.setmode(wifi.STATION)
  3. print('set mode=STATION (mode='..wifi.getmode()..')')
  4. print('MAC: ',wifi.sta.getmac())
  5. print('chip: ',node.chipid())
  6. print('heap: ',node.heap())
  7. wifi.sta.config("Internet","")
  8. tmr.alarm(0, 3000, 1, function()
  9. if wifi.sta.getip() == nil then
  10. print("Connecting to AP...")
  11. else
  12. tmr.stop(0)
  13. print('IP: ',wifi.sta.getip())
  14. -- Uncomment to automatically start the server.
  15. -- require("httpserver")
  16. -- server = httpserver.start(80, 10)
  17. end
  18. end)