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