Hi GEONU,
While reviewing the code, I found out that the callback function is not being triggered, which could be due to incorrect syntax.
You should use "@(src,data) app.MQTT_Sub_Callback(src, data)" instead of just using "@MQTT_Sub_Callback".
Additionally, there's a syntax error involving an extra set of parentheses during the MQTT initialization in the 'CREATEButtonPushed' method.
Additionally, you will also need to make some adjustments to the Callback function as the data which it receives is different than what it expects. You may consider modifying the function along these lines:
function MQTT_Sub_Callback(app, ~, data)
topic = data.Topic;
msg = char(data.Message);
% Your previous code
end
You can refer to the documentation on MQTT and App designer for more information: