TimeOut & Delta made easy (Arduino C)
MKDelay v1.0 Author: Mateusz Kozicki "Kozaluss"
Date: 2023.11.05
Manage time with ease - timeout events and deltas.
- Include header:
#include "MKDelay.h"
- Declare object:
MKDelay MyDelay;
- In setup - initialize with timeout value (millis), then reset:
MyDelay.SetTimeOut(1000);
MyDelay.Reset();
- In loop - check if timeout happened.
if( MyDelay.IsTimeOut() ){...}
void SetTimeOut(long parTimeOut);
Set time out in milliseconds. Event will fire every parTimeOut.
void Reset();
Reset timer to zero.
bool IsTimeOut();
Check if the time run out. If so, it automatically resets to be ready to catch next one.
long GetDelta();
Get the time, that passed since last reset/timeout.
long GetSubDelta();
Get the time, that passed since last time check. Used internally by GetDelta, but can be useful alone as well. Warning - max value 100000, then resets.