When my system is confronting at logical & hardwaretical problem, I want to make system know It has some problem and reset automatically because my esp8266(nodeMCU) is on the place where people usually cannot touch.

so I apply this 'ticker' code, but I think they are not working when it is on problem status.

please see my code and give me some advice that how to make system know the problem status and do reset automatically.

//these are global values
Ticker ticker;
volatile unsigned int ISRcounter = 0;

void setup(){

//ticker always give Interrupt every 2 second.
//and when it get Interrupt, ISRdog function is called.

void ISRdog() {
  ISRcounter += 1;
//when ISR is called, ISRcounter is ++.

  if (ISRcounter == 10) {
    ESP.deepSleep(5e5); //reset
//and when it is 10, deepSleep for 5second and automatically wakeup.
//so it means, 'system reset'



void loop(){

//when program running properly, system's flow always go to loop in final.
//so at the loop, make ISRcounter =0, for not making the system reset(ISRcounter==10)


...and other functions ....

In short, this code is making reset until the system is not entering the loop() over 20second.

so I expect when system get problem somehow, then system do not enter to the loop() and It means ISRcounter is getting 10, without =0. so system should be resetted. but It did not worked. did not automatically resetted.

  • esp8266 always runs the watchdog – Juraj Sep 3 '19 at 8:34
  • by iteself without my code? I saw. but when it resetted like that, it do not rework properly I think. for example, spreading wifi signal as a server... – lee du Sep 3 '19 at 8:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.