Arduino MQTT connection via read file

Asked

Viewed 18 times

1

When connecting to the mqtt server using the Pubsubclient library, I can connect normally using:

#define servidor_mqtt "192.168.15.24"

Only this way I get hitched to always use the same address for Broker.

So, I made a program that reads the Broker IP and saves it in a file for when to start the connection use this parameter.

The problem is that it is not connecting, even being equal both the static IP and the reading.

// rascunho 

STATIC_SERVER_MQTT = f.readStringUntil('\n');<br>
char cserver[STATIC_SERVER_MQTT.length()];<br>
STATIC_SERVER_MQTT.toCharArray(cserver, STATIC_SERVER_MQTT.length()+1);<br>
char* serverMqtt = cserver;<br>
client.setServer(serverMqtt, 1883);
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.