/ESP32_MQTT_BaiDuCloud

通过HTTP协议读取实时天气,然后使用cJSON进行解码,最后将温度和天气状况上传到百度云服务器(您可以订阅百度云相关主题),并实时更新 / Read the real-time weather through the HTTP protocol, then use cJSON to decode, finally upload the temperature and weather conditions to the Baidu cloud server (you can subscribe to Baidu cloud related topics), and update in real time

Primary LanguageAssembly

描述

该项目可以直接修改,连接网络上任何MQTT协议的服务器📃

📁修改WIFI连接部分

#define EXAMPLE_WIFI_SSID        "HUAWEI-3AHFVD"//需要连接到的wifi热点名称SSID
#define EXAMPLE_WIFI_PASS        "13550695909"	//需要连接到的wifi热点名称密码

🔨修改MQTT连接地址及其password

esp_mqtt_client_config_t mqtt_cfg = {
    .host = "183.240.93.18",            //MQTT服务器IP
    .username = "xmh6fy0/stm32f4",		//MQTT服务器username
    .password = "bJYDuKbxcOMikzLd",		//MQTT服务器password
    .client_id = "esp32",				//客户端名字(任意)
    .event_handle = mqtt_event_handler, //MQTT事件
    .port=1883,                         //端口(默认)
    // .user_context = (void *)your_context
};

🔧修改你需要订阅的服务器主题

msg_id = esp_mqtt_client_subscribe(client, "test", 1);//test为你所订阅的主题,1为服务质量为QoS1