Skip to content

Industrial-Shields/arduino-Counter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

arduino-Counter

The Counter library provides a way of counting rising edges until a defined preset value.

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/Counter" menu.

Usage

#include <Counter.h>

Counter C(100);

The Counter returns HIGH when the internal counter is equal to the preset value.

int up = digitalRead(I0_0);
int down = digitalRead(I0_1);
int reset = digitalRead(I0_2);
if (C.update(up, down, reset, preset) == HIGH) {
    // Enter here when the counter is equal to 100
	// The counter counts up when I0.0 rises
	// The counter counts down when I0.1 rises
	// The counter is set to zero when I0.2 is HIGH
}

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages