ESP連結小米手機WiFi熱點測試
20181021w
ESP連結小米WiFi熱點測試
print(‘Setting up WIFI…’)
wifi.setmode(wifi.STATION)
wifi.sta.config(‘jpf’, ‘12345678’)
wifi.sta.connect()
tmr.alarm(1, 1000, tmr.ALARM_AUTO, function()
if wifi.sta.getip() == nil then
print(‘Waiting for IP …?’)
else
print('IP is ’ … wifi.sta.getip())
tmr.stop(1)
end
end)
成功獲取IP地址:
print(‘Setting up WIFI…’)
Setting up WIFI…
wifi.setmode(wifi.STATION)
wifi.sta.config(‘jpf’, ‘12345678’)
wifi.sta.connect()tmr.alarm(1, 1000, tmr.ALARM_AUTO, function()
if wifi.sta.getip() == nil then
print(‘Waiting for IP …?’)
else
print('IP is ’ … wifi.sta.getip())
tmr.stop(1)
end
end)Waiting for IP …?
Waiting for IP …?
Waiting for IP …?
Waiting for IP …?
IP is 192.168.43.61
連結成功頁面:
優酷路由器刷潘多拉頁面
Waiting for IP …?
Waiting for IP …?
Waiting for IP …?
IP is 192.168.1.115
1.設定SSID區分大小寫
2.密碼錯誤,只顯示MAC地址,獲取不了IP地址