init.lua 468 B

12345678910111213141516171819
  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. tmr.alarm(0, 3000, 1, function()
  10. if wifi.sta.getip() == nil then
  11. print("Connecting to AP...")
  12. else
  13. tmr.stop(0)
  14. print('IP: ',wifi.sta.getip())
  15. end
  16. end)