Re: client.connected() error
Posted: Fri Jun 30, 2017 1:48 am
Oh yes!
I solved it thanks to everyone.
I had already found that it was a ram problem and thanks to gbafamily1 I have:
1) I changed the library and added the method CLOSE_ABORT()
(https://github.com/pfabri/Arduino/commi ... 26240bc2f3)
but free heap size goes down
2) I change call the deconstructor directly but I used delete
(https://github.com/esp8266/Arduino/issues/1070)
but free heap size goes down
3) Utilized CLOSE_ABORT() and delete together and worked very well.
the code utilized:
I solved it thanks to everyone.
I had already found that it was a ram problem and thanks to gbafamily1 I have:
1) I changed the library and added the method CLOSE_ABORT()
(https://github.com/pfabri/Arduino/commi ... 26240bc2f3)
but free heap size goes down
2) I change call the deconstructor directly but I used delete
(https://github.com/esp8266/Arduino/issues/1070)
but free heap size goes down
3) Utilized CLOSE_ABORT() and delete together and worked very well.
the code utilized:
Code: Select all
......
void loop() {
//const int httpPort = 80;//define in the global scope
//const char* host = "www.google.it";//define in the global scope
if((WiFi.status() == WL_CONNECTED)) {
WiFiClient * client = new WiFiClient();
client->connect(host, httpPort);//open the connection
//...... code .......
//close connection and free heap
client->stop_abort();
delete client;
Serial.println("closing connection");
}else
{
Serial.println("---->not connection");
}
delay(200);
}
....