Skip to content

kozaluss/MKDelay

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

MKDelay

TimeOut & Delta made easy (Arduino C)

MKDelay v1.0 Author: Mateusz Kozicki "Kozaluss"

Date: 2023.11.05

What is this?

Manage time with ease - timeout events and deltas.

How to use:

  1. Include header:
#include "MKDelay.h"
  1. Declare object:
MKDelay MyDelay;
  1. In setup - initialize with timeout value (millis), then reset:
MyDelay.SetTimeOut(1000);
MyDelay.Reset();
  1. In loop - check if timeout happened.
if( MyDelay.IsTimeOut() ){...}

Class functions reference:

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.


About

TimeOut & Delta made easy (Arduino C)

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages