这怎么解决?????
#define publish_normaldata "{\"device id\":%x%x,\"Don't smoke\": \"No\"}"
char normal_data[255]={0};
esp_base_mac_addr_get(mac);
printf("device mac = %x:%x:%x:%x:%x:%x\r\n",mac[0],mac[1],mac[2],mac[3],mac[4],mac[5]);
sprintf(normal_data, publish_normaldata,mac[4],mac[5]);
sprintf(cPayload, "%s",normal_data);
paramsQOS1.payloadLen = strlen(cPayload);
aws_iot_mqtt_publish(&client, TOPICB, TOPICB_LEN, ¶msQOS1);
以json格式的数据上传到AWS控制台,结果转换成 UTF-8 字符串形式显示。
-
- Posts: 171
- Joined: Thu Sep 23, 2021 10:03 am
Who is online
Users browsing this forum: No registered users and 92 guests