Periodic

open class Periodic : Runnable

A function wrapper that only calls the function every so often at a user-defined interval.

This is useful for operations that should be delayed or slowed down, such as reading or writing to hardware.

Author

Lucas Bubner, 2024

Since

6.1.0

Constructors

Link copied to clipboard
constructor(interval: Measure<Time>, function: Runnable)
Creates a new periodic function wrapper.

Functions

Link copied to clipboard
open fun reset()
Resets the timer for this periodic function.
Link copied to clipboard
open fun run()
Link copied to clipboard
open fun runNow()
Calls the function immediately, ignoring the set interval.