Chat freely about anything...

User avatar
By alonewolfx2
#6580 ho can i send data to the broker? i didn't find wiki.
the code is not working
Code: Select allchar dataBuf[64];
   memcpy(dataBuf,"esptest",strlen("esptest"));
   int data_len=strlen(dataBuf);
   MQTT_Publish(&mqttClient, "/test/", dataBuf, data_len, 1, 1);
User avatar
By rvbcrs
#6607 Ok cool, I get everything working now!
I have connected a DHT11 temperature sensor, can you please tell me how I can publish the temperature every now and then so a mqtt subscriber can receive it?

Thanks!
User avatar
By jimbo
#6696 Thanks for the library tuanpm! I managed to compile and upload it successfully (I'm new to all this), and see in my serial monitor that it connects succesfully to my AP, the internet and the (cloud) MQTT broker. I didn't alter anything other than the necessary credentials.

However, I've got a few other subscribers/publishers that listened/posted to the sample 2 topics, but I don't see any messages on the serial monitor or on my other pub/sub applications. Is this standard behaviour?

Code: Select allMQTT: Connected to xxx.cloudmqtt.com:xxxx
MQTT: Connected
MQTT: subscribe, topic"/test/topic" at broker xxx.cloudmqtt.com:xxxx
MQTT: subscribe, topic"/test2/topic" at broker xxx.cloudmqtt.com:xxxx
TCP: Sent
TCP: data received
MQTT: Subscribe successful
[*snip*, and repeated every now and then:]
MQTT: Send keepalive packet to xxx.cloudmqtt.com:xxxx!
TCP: Sent
MQTT: Published
TCP: data received