Skip to main content

imp.cancelwakeup(timer)

Cancels a timer previously established by imp.wakeup()

Availability

Device (from impOS™ 27) + Agent

Parameters

Name Type Description
timer Timer object A timer object as returned by imp.wakeup()

Returns

Nothing

Description

To use this method, you must already have a reference to the timer you wish to cancel. Creating a new timer with imp.wakeup() returns a reference to the new timer. Store this reference in a variable and you can later pass the reference to imp.cancelwakeup() if you need to.

If the timer has not yet fired, once cancelled it never will. Cancelling a timer that has already fired has no effect. Cancelling a timer, whether it has fired or not, does not null the reference.

The method can be applied to timers established by either a device or an agent, but the method doesn’t allow an agent to cancel a timer established by a device, or vice versa.

Example Code

The following example uses imp.cancelwakeup() to suspend a regular timer-based loop in response to the arrival of new data, in this case in index value indicating a specific color in an array of RGB colors.