VariableTimedAction  1.2.2
This is a library used for scheduling events written specifically for the Arduino community.
Public Member Functions | Static Public Member Functions
VariableTimedAction Class Referenceabstract

This class is used as an interface to create a timed loop to perform repetitive actions. More...

#include <VariableTimedAction.h>

Public Member Functions

void start (unsigned long startInterval, bool startNow=true)
 Starts the timer and sets the interval that the #run method should be called. More...
 
void toggleRunning ()
 Toggles the timer on and off. More...
 
bool isRunning ()
 Returns current status of the timer. More...
 
void stop ()
 Stops the timer, removing it from the list of actions. More...
 

Static Public Member Functions

static void updateActions ()
 Iterates through all actions and calls the #run method on actions whose interval has passed. More...
 

Detailed Description

This class is used as an interface to create a timed loop to perform repetitive actions.

The implementing class must override the pure virtual function #run, which will be called every interval. However, the user specified interval defines the minimum length of time which can be passed before the action is executed.

Created on December 14, 2016, 4:43 PM

Author
amirchev
Version
1.2.2

Member Function Documentation

◆ isRunning()

bool VariableTimedAction::isRunning ( )
inline

Returns current status of the timer.

Returns
True if the timer is running, false if it is paused or stopped.

◆ start()

void VariableTimedAction::start ( unsigned long  startInterval,
bool  startNow = true 
)

Starts the timer and sets the interval that the #run method should be called.

This method can be called whether the timer is stopped or paused. If it is stopped or has never been started, it will be started. If it is paused, then it will resume using the new interval.

Parameters
startIntervalThe interval to wait between calls to #run.
startNowIf true, the timer will execute #run right away and then wait until the next interval. Otherwise, the timer will execute after the interval has passed.

◆ stop()

void VariableTimedAction::stop ( )

Stops the timer, removing it from the list of actions.

If the timer has to be started again, then use start as it will need to be added into the list of actions.

◆ toggleRunning()

void VariableTimedAction::toggleRunning ( )

Toggles the timer on and off.

This is faster than stopping and starting the timer every time.

◆ updateActions()

static void VariableTimedAction::updateActions ( )
static

Iterates through all actions and calls the #run method on actions whose interval has passed.

This method should be called frequently in the #loop method. In timing-intensive applications, this method should be the only thing in the loop method.


The documentation for this class was generated from the following files: