I have an ESP8266 running an Arduino code to control a dual relay device ( Up, Down, Off ), both from a physical switch and MQTT commands. After mounting the device in place I have no access in case of a need to reset ( just as a precaution ).

My workaround:

1) condition: function that on 4 detection of 4 repeated UP button presses - it should send a reboot signal.

2) the reboot signal is :

void sendReset() {
  Serial.println("Sending Reset command");

sendReset function actually reboots the device and boot occurs as needed, BUT - is doing it this way is a valid solution ? does boot process actually boots all services and freeing/ memory or any other.... AS NEEDED ?


1 Answer 1


1/0 is an exception (divide by zero). esp8266 arduino core has soft reset: ESP.reset(). Calling this function you get a valid reset.

Note to software reset. esp8266 has a bug. If software reset (or exception) is executed in program started right after the flashing, the board goes back to flashing mode because the flashing flag is still active. Perhaps you noticed that after flashing the bootloader doesn't reset the board, but executes the flashed code.

  • Hi! Yes I know it is an exception, but it causes a reset. Does an Arduino board has also a reset function?
    – guyd
    Commented Oct 30, 2018 at 6:31
  • read the answer, please
    – Juraj
    Commented Oct 30, 2018 at 6:34
  • I read your answer before it was edited ( 1st paragraph only ). Thanks for additional information. My question in the comment was a generelized question regarding Arduino boards ( Nano for example ) it it has also a reset command.
    – guyd
    Commented Oct 30, 2018 at 7:50
  • Nano? you write the code for esp8266. yes there is a reset solution for AVR too. with watchdog
    – Juraj
    Commented Oct 30, 2018 at 7:57
  • 1
    OTA makes ESP.reset(). it is good. (it doesn't work only at first reset after serial upload)
    – Juraj
    Commented Dec 3, 2018 at 9:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.