nodemcu通过mqtt实现实时通信

1.windows下服务器的搭建

我选择了比较简单的emqx服务器,参考了大佬的博文

https://blog.csdn.net/Mr_robot_strange/article/details/103881635?ops_request_misc=%257B%2522request%255Fid%2522%253A%2522165076262116782350930112%2522%252C%2522scm%2522%253A%252220140713.130102334..%2522%257D&request_id=165076262116782350930112&biz_id=0&utm_medium=distribute.pc_search_result.none-task-blog-2allsobaiduend~default-1-103881635.142v9control,157v4control&utm_term=%E5%AE%89%E8%A3%85emqx&spm=1018.2226.3001.4187​

安装完emqx后在bin文件下启动

​登录localhost:18083或127.0.0.1:18083进入控制台界面

​emqx默认端口号1883

2.arduino部分

先在nodemcu上烧录有关mqtt的固件,再到arduino进行烧写

/*
 Basic ESP8266 MQTT example
 This sketch demonstrates the capabilities of the pubsub library in combination
 with the ESP8266 board/library.
 It connects to an MQTT server then:

* publishes "hello world" to the topic "outTopic" ev
  • 0
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值