In connection with the mqtt server using the PubSubClient library, I can connect normally using:
#define servidor_mqtt "192.168.15.24"
But this way I'm always going to use the same address for the broker.
So, I made a program that reads the broker's IP and saves it to a file when the connection starts using this parameter.
The problem is that you are not connecting, even though both static and read IP are the same.
// 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);