Post topics, source code that relate to the Arduino Platform

User avatar
By dhovden
#38220 Building an app which uses the MySQL connector to send various measured data to a MySQL database. Works well but at times the MySQL connection goes away and refuses to return, the only way to get it back is a hard reset of the ESP8266 (in the form of an AdaFruit Huzzah).

Now, I would like to detect this in software and issue a restart from the code. This is what I'm using now to restart:

void soft_reset() {
pinMode(0,OUTPUT);
digitalWrite(0,1);
pinMode(2,OUTPUT);
digitalWrite(2,1);

ESP.restart();
}

But it doesn't work, at least not completely. The ESP8266 stops, sends some weird characters to the serial monitor but that's it: no restart.

Setting GPIO0 and 2 high, read that at https://github.com/esp8266/Arduino/issues/793, not sure if it's correct.

Anyway, does anyone know a way to restart the ESP8266 from code that actually works? Or am I just missing something?
User avatar
By martinayotte
#38246 ESP.reset() is working fine for me ...

But maybe you should look at the real solution with your MySQL server with the ESP.
Are you doing some kind of TCPClient to the server ? you can probably add a timeout there...
User avatar
By paulfer
#52663
martinayotte wrote:ESP.reset() is working fine for me ...

But maybe you should look at the real solution with your MySQL server with the ESP.
Are you doing some kind of TCPClient to the server ? you can probably add a timeout there...


I found this...https://github.com/esp8266/Arduino/issues/1722

You need to manually restart after flashing via serial.

Then it works. For me at least.