LED.Timer (led v0.1.1)
View SourceTimer helper functions for managing LED blinking and repeating patterns.
Provides mechanisms to send timed messages for blinking intervals, including support for infinite repeats and countdowns.
Summary
Functions
Cancels a list of timer references to stop scheduled timer messages.
Schedules the next timer message for LED blinking or repeating patterns.
Functions
Cancels a list of timer references to stop scheduled timer messages.
timer_refsis a list of references returned byProcess.send_after/3.- If a
niltimer_ref is encountered, logs a debug message and skips cancellation.
Schedules the next timer message for LED blinking or repeating patterns.
Accepts a tuple
{state, interval, times}where:stateis0(off) or1(on).intervalis the delay in milliseconds before sending the next message.timesis the number of remaining toggles;-1means infinite repeats.
If
timesis-1, schedules the timer infinitely.If
timesis0, does nothing (no timer scheduled).If
stateis0, decrementstimesand schedules the next timer.If
stateis1, schedules the next timer without decrementingtimes.
Returns the timer reference or nil if no timer is scheduled.