STM32 esp 8266 MQTT连接阿里云私有简单协议 六行代码实现数据上传

void WIFI_CONTECT()
{
	
	printf("AT+CIPSNTPCFG=1,8,\"ntp1.aliyun.com\"\r\n");
	delay_ms(800);
	printf("AT+MQTTUSERCFG=0,1,\"NULL\",\"smart_hlment&h21qEQyRDcS\",\"D89A52AE8F651ABC70D37B7A03AD58DE98DE8C24\",0,0,\"\"\r\n");
	delay_ms(800);
	printf("AT+MQTTCLIENTID=0,\"112233|securemode=3\\,signmethod=hmacsha1\\,timestamp=456|\"\r\n");
	delay_ms(800);
	printf("AT+MQTTCONN=0,\"h21qEQyRDcS.iot-as-mqtt.cn-shanghai.aliyuncs.com\",1883,1\r\n");
	delay_ms(800);
	printf("AT+MQTTSUB=0,\"/sys/h21qEQyRDcS/${smart_hlment}/thing/service/property/set\",1\r\n");
	delay_ms(800);
	HAL_GPIO_WritePin(GPIOA,GPIO_PIN_8,GPIO_PIN_SET);
	delay_ms(500);
	HAL_GPIO_WritePin(GPIOA,GPIO_PIN_8,GPIO_PIN_RESET);
}
 printf("AT+MQTTPUB=0,\"/sys/h21qEQyRDcS/smart_hlment/thing/event/property/post\",\"{\\\"method\\\":\\\"thing.service.property.set\\\"\\,\\\"id\\\":\\\"1234567891\\\"\\,\\\"params\\\":{\\\"qxzt\\\":%d}\\,\\\"version\\\":\\\"1.0.0\\\"}\",1,0\r\n",shigubiaozhiwei);

  • 0
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值