Advertisement
Guest User

Untitled

a guest
Jan 29th, 2015
191
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.89 KB | None | 0 0
  1. if true then --change to if true
  2. print("set up wifi mode")
  3. wifi.setmode(wifi.STATION)
  4. --please config ssid and password according to settings of your wireless router.
  5. wifi.sta.config("XavierAP","xxxxcccc")
  6. wifi.sta.connect()
  7. cnt = 0
  8. tmr.alarm(1, 3000, 1, function()
  9. if (wifi.sta.getip() == nil) and (cnt < 20) then
  10. print("IP unavaiable, Waiting...")
  11. cnt = cnt + 1
  12. else
  13. tmr.stop(1)
  14. if (cnt < 20) then print("Config done, IP is "..wifi.sta.getip())
  15. --dofile("yourfile.lua")
  16. else print("Wifi setup time more than 20s, Please verify wifi.sta.config() function. Then re-download the file.")
  17. end
  18. end
  19. end)
  20. else
  21. print("\n")
  22. print("Please edit 'init.lua' first:")
  23. print("Step 1: Modify wifi.sta.config() function in line 5 according settings of your wireless router.")
  24. print("Step 2: Change the 'if false' statement in line 1 to 'if true'.")
  25. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement