ESP Home Documentation
LOGIN

Timers

ESP.setTimeout

Runs the function once in future.

Syntax:
ESP.setTimeout(function, milliseconds)

  • function is the function that will be executed in future.
  • milliseconds is the amount of time to delay the execution.

This function returns an identifier for the timer which you can use to cancel the execution before it happens.

ESP.cancelTimeout

Cancels a previously created timer with setTimeout.

Syntax:
ESP.cancelTimeout(timer_id)

  • timer_id returned ID of the timer from setTimeout.

ESP.setInterval

Runs the function in future in given interval.

Syntax:
ESP.setInterval(function, milliseconds)

  • function is the function that will be executed in future.
  • milliseconds is the amount of time to delay the execution.

This function returns an identifier for the timer which you can use to cancel the execution.

ESP.cancelInterval

Cancels a previously created timer with setInterval.

Syntax:
ESP.cancelInterval(timer_id)

  • timer_id returned ID of the timer from setInterval.