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 …?’)