Explanation
You have to think so, cloud platform is a web version of MQTT server + client
Then nothing more than the leaflet, we take a look at the device is connected to the IP number, port number, ID, user name, password, subscriptions to the publication's theme ...
Whether behind the device is AT, LUA, SDK, Android, C #, Python, web pages, applets, etc., etc. .....
MQTT want them to connect the Internet of Things platform, to know how they achieve MQTT
Then want to connect cloud platform, cloud platform to fill those parameters would be finished. Do not try more, it is that simple.
Learn something, the most important is the idea ..
Realization of functions
The microcontroller in the acquisition of temperature and humidity display cloud platform
Implementation steps 1
1. In a cloud platform to get another custom function
Achieve step 2
I just modify the microcontroller program this section
https://www.cnblogs.com/yangfengwu/p/11760590.html
1. In order to facilitate the use, I modified into the following
Direct user can modify according to their own
Download the program and test MCU
An adjusting rocker switch position, the STM32 and Wi-Fi communication
Second, short the STM32 PB2 and Wi-Fi module RST pin (in order to make the project a stable and reliable, use the single-chip hardware reset Wi-Fi)
Third, do not forget to let the Wi-Fi router connection module
https://www.cnblogs.com/yangfengwu/p/11760590.html
Fourth, to see if there is no data on their platform
Fifth, the stage control relay
{"data":"switch","bit":"1","status":"1"}
Control relay off
Program Description
A combination of IP, user name, published by themes here
Connection part or the connection part
Nothing can change the way ,,,,
That is, for the connection address MQTT only, and some parameters fixed it
You do not need to use the MAC device as ClientID
and so
Subscribe changed to subscribe / a1m7er1nJbQ / Mqtt / user / get
Microcontroller processing MQTT news
Ali cloud need to follow to send data format
注意一件事情,想一次发送多个数据,数据格式是这样的
"{\"method\":\"thing.event.property.post\",\"id\":\"1111\",\"params\":{\"temp\":%d,\"humi\":%d},\"version\":\"1.0.0\"}"
{\"temp\":35,\"humi\":88} //temp和humi就是咱上面咱设置的标识符