8266对接天猫精灵固件

作者:GAO0594 | 更新时间:2019-11-05

8266对接天猫精灵固件,谁有?

LED =3 gpio.mode(LED,gpio.OUTPUT) cu = net.createConnection(net.TCP) cu:connect(port, host) ok, s = pcall(sjson.encode, {M="checkin",ID=DEVICEID,K=APIKEY}) if ok then print(s) else print("failed to encode!") end cu:on("receive", function(cu, c) print(c) r = sjson.decode(c) if r.M == "say" then if r.C == "play" then gpio.write(LED, gpio.HIGH) ok, played = pcall(sjson.encode, {M="say",ID=r.ID,C="LED turn on!"}) cu:send( played.."\n" ) end if r.C == "stop" then gpio.write(LED, gpio.LOW) ok, stoped = pcall(sjson.encode, {M="say",ID=r.ID,C="LED turn off!"}) cu:send( stoped.."\n" ) end end end) tmr.create():alarm(20000, tmr.ALARM_AUTO, function() cu:send( s.."\n" ) print(s) end)

评论:共2条

GAO0594 评论于:2019-10-30 00:22:52
01S的,ESP-12F 5路输出口。
GAO0594 评论于:2019-11-05 15:47:32
8266刷固件工具我有,我的Q我
编译工具源代码以及环境配置,有没有大虾指教一下?/
评论支持使用[code][/code]标签添加代码
返回顶部