VariableTimedAction  1.2.2
This is a library used for scheduling events written specifically for the Arduino community.
VariableTimedAction.h
1 #ifndef VARIABLETIMEDACTION_H
2 #define VARIABLETIMEDACTION_H
3 
4 #include <Arduino.h>
5 
18 public:
19 
31  void start(unsigned long startInterval, bool startNow = true);
36  void toggleRunning();
42  bool isRunning() {
43  return running;
44  }
49  void stop();
57  static void updateActions();
58 
59 private:
60  unsigned long interval;
61  unsigned long nextTick;
62  bool running = false;
63  int index = -1;
64 
65  static int maxActions;
66  static VariableTimedAction ** actions;
74  virtual unsigned long run() = 0;
75  void update();
76 };
77 
78 #endif /* VARIABLETIMEDACTION_H */
void stop()
Stops the timer, removing it from the list of actions.
Definition: VariableTimedAction.cpp:67
This class is used as an interface to create a timed loop to perform repetitive actions.
Definition: VariableTimedAction.h:17
void start(unsigned long startInterval, bool startNow=true)
Starts the timer and sets the interval that the #run method should be called.
Definition: VariableTimedAction.cpp:12
bool isRunning()
Returns current status of the timer.
Definition: VariableTimedAction.h:42
void toggleRunning()
Toggles the timer on and off.
Definition: VariableTimedAction.cpp:58
static void updateActions()
Iterates through all actions and calls the #run method on actions whose interval has passed...
Definition: VariableTimedAction.cpp:85