将硬件的三轴传感器和可燃气体传感器和 AIR780E 数据打包至 EMQX 服务器

local mqtt_host = "www.visionexpand.com.cn"

local mqtt_port = 1883

local mqtt_isssl = falselocal client_id = "emqx"

local pub_topic = "$thing/up/property/IQMPOB8BI9/temp/humi"

local sub_topic = "mqtt"

local uart2_data = "text"-- libgnss库初始化libgnss.clear() -- 清空数据,兼初始化

if wdt then wdt.init(9000) sys.timerLoopStart(wdt.feed, 3000) endsys.taskInit(function() if rtos.bsp() == "AIR780E"

then device_id = mobile.imei() sys.waitUntil("IP_READY", 30000)

pub_topic = "$thing/up/property/IQMPOB8BI9/temp/humi" sub_topic = "mqtt"

end log.info("mqtt", "pub", pub_topic) log.info("mqtt", "sub", sub_topic)

local mqttc = mqtt.create(nil, mqtt_host, mqtt_port, mqtt_isssl, nil)

mqttc:auth(client_id, nil, nil) mqttc:autoreconn(true, 3000) mqttc:on(function(mqtt_client, event, data, payload)

if event == "conack" then sys.publish("mqtt_conack") mqtt_client:subscribe(sub_topic)

elseif event == "recv"

评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值