ESP8266 Arduino: Software restart

- Posted in mikrokontroler by

In this tutorial we will check how to perform a software restart on the ESP8266 using the Arduino IDE core.
To restart the ESP8266, we need to call the restart method on the ESP extern variable, which is an object of class EspClass (header file available here). This ESP object can be accessed in our code without the need for any .h file include.

if(cnt==0){
    Serial.println("Reset..");
    ESP.restart();
}

Note that there’s actually a reset method also available on the ESP object. However, this method call is a hard reset that can leave some ESP8266 registers in their old state, which may lead to problems. On the other hand, the restart method we have used indicates to the ESP8266 SDK to reboot, which is cleaner and is the recommended method.
Referensi: https://techtutorialsx.com/2017/12/29/esp8266-arduino-software-restart/