I am trying to communicate with a MQTT broker inside a app but my callback functions don't run.
It gives me the following error: Invalid callback function 'myMQTT_RdAllPow_Callback' for input arguments of type 'string'.
The code is bellow:
app.myMQTT = mqtt(mqttServerAddr,'Username','test','Password','test','Port',1883);subscribe_regCallback(app, app.myMQTT);app.ConnectedLamp.Color = 'green';app.NotConnectedLabel.Text = 'Connected';while 1 publish(app.myMQTT, 'VGA/RdAllPow', '1'); pause(5);endfunction subscribe_regCallback(app,myMQTT) app.RdAllPow = subscribe(myMQTT, 'VGA/RdAllPow', 'QoS', 0, 'Callback', @myMQTT_RdAllPow_Callback);endfunction myMQTT_RdAllPow_Callback(app,~) app.ConnectedLamp.Color = 'yellow';
Best Answer