-->
Page 1 of 1

CALLBACK FUNCTION

PostPosted: Mon Dec 27, 2021 10:23 pm
by osmosoom
Hello,

I actually have three question about the code I am using to turn a device on and off via WiFi and MQTT. Based upon what I am seeing in the Arduino IDE, MQTT is connecting and reconnecting repeatedly. It seems to me this should happen just once.

Also, on a different note, I don't understand how the callback function in the code can keep executing (as it is supposed to) everytime a new message is published by MQTT since the callback code lies within the void setup() which I understand runs only once.

Finally, with regard to the void calback function, how is it that the three arguments (topic, message and length) are being populated?

Attached is the code.

Any help someone could provide would be most appreciated!
Thank you,

Re: CALLBACK FUNCTION

PostPosted: Tue Jan 04, 2022 7:04 am
by rpiloverbd
Hello,
Can't see the code. However, as you are facing problems with MQTT, this tutorial may help you. It is based on ESP32. https://www.theengineeringprojects.com/ ... -mqtt.html