init.lua 551 B

12345678910111213141516171819
  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 in port 80
  15. -- dofile("httpserver.lc")(80)
  16. end
  17. end)