Skip to content

Erutan409/Arduino-Avail

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 

Repository files navigation

Arduino Avail

Method for comparing two milliseconds to each other for asserting true/false criteria.

Example:

unsigned long lastTimestamp = 123455; // in milliseconds
unsigned long margin = 150; // milliseconds before needing to do something

if (Avail::millis(&margin, &lastTimestamp)) {
    // do stuff after waiting the length of 'margin'
} else {
    // continue looping through code
}

If you need to know whether or not a rollover has occurred with the millis() counter, do the following:

unsigned long lastTimestamp = 123455; // in milliseconds
unsigned long margin = 150; // milliseconds before needing to do something
bool rollover; // this will be assigned the approrpiate flag when being passed by reference

if (Avail::millis(&margin, &lastTimestamp, rollover)) {
    // do stuff after waiting the length of 'margin'
} else {
    // continue looping through code
}

if (rollover) {
    // perform other necessary logic
}

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages