How to call same MQTT client.connect() instance in .cpp as well as in ino file?

Hello,

I declared MQTT client(“broker”, port,callback,512); in .ino file and want to use same instance in .cpp file for some process.

is it possible to use the same instance or I have to open again a new connection to use in the .cpp file?

You’d need to define an extern object variable of the same name in your external module (e.g. .cpp)

1 Like

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.