nodemcu web 测试OK

print('Setting up WIFI...')
wifi.setmode(wifi.STATION)
wifi.sta.config('TP-LINK_E34620', '12341234')
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)


srv=net.createServer(net.TCP)
srv:listen(80,function(conn)
conn:on("receive",function(conn,payload)
print(payload)
conn:send("<h1> Hello, NodeMcu.</h1>")
end)
end)

 

 用google ie 看没有问题 

posted @ 2017-03-12 12:22  风 雨 无 阻  阅读(102)  评论(0)    收藏  举报