Skip to content

Industrial-Shields/arduino-Timer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

arduino-Timer

The Timer module provides three different kind of Timers, based on standard timer schemes:

PulseTimer PT(1000);
OnDelayTimer TON(1000);
OffDelayTimer TOF(1000);

The PulseTimer returns HIGH during the defined time when a rising edge in the input is generated.

The OnDelayTimer returns HIGH when the input is HIGH during the defined time and until the input falls.

The OffDelayTimer returns LOW when the input is LOW during the defined time and until the input rises.

Gettings started

Prerequisites

  1. The Arduino IDE 1.8.0 or higher
  2. The Industrial Shields Arduino boards (optional, used in the examples)

Installing

  1. Download the library from the GitHub as a "ZIP" file.
  2. From the Arduino IDE, select the downloaded "ZIP" file in the menu "Sketch/Inlcude library/Add .ZIP library".
  3. Now you can open any example from the "File/Examples/Timer" menu.

Usage

#include <Timer.h>

PulseTimer

PulseTimer PT(1000);

int in = digitalRead(I0_0);
if (PT.update(in) == HIGH) {
    // Enter here during 1000ms after in is rised
}

OnDelayTimer

OnDelayTimer TON(1000);

int in = digitalRead(I0_0);
if (TON.update(in) == HIGH) {
    // Enter here after I0.0 is HIGH during 1000ms and until it becomes LOW
}

OffDelayTimer

OffDelayTimer TOF(1000);

int in = digitalRead(I0_0);
if (TOFF.update(in) == HIGH) {
    // Enter here after I0.0 is LOW during 1000ms and until it becomes HIGH
}

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages