When using the Ticker library on the ESP8266 you can't use the delay() function because Ticker functions are using the underlying timer. The original Arduino library says that you can use a Ticker as delay, but in the ESP8266 implementation things work differently. You "attach()" a callback function and specify the period.

How can I generate a delay that doesn't require the underlying timer?

(BTW, where is the documentation for the ESP8266 Ticker library? The repository has no documentation nor comments on the functions.)


use the ticker callback to increment a value. this value can be used as millis() substitute. actually the "millis" is made that way.

write a simple function to give you a delay. this code assumes the callback function is interrupt/event driven like a systick timer in ARMs.

uint32_t ticks;

void callbackFunc()

void myDelay(uint32_t del)
   uint32_t tempTime = ticks;
   while (ticks < tempTime + del);
  • Yes. That seems to work, but I do need to put ESP.wdtFeed(); inside the while loop in the delay function. Otherwise the watchdog timer is triggered.
    – A. Vieira
    Sep 13 '19 at 20:36

Your Answer

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

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