Skip to content

A button library that handles multi-clicks, long clicks and click-and-hold

License

Notifications You must be signed in to change notification settings

MichMich/clickButton

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ClickButton

A library that decodes multiple clicks on one button. Also copes with long clicks and click-and-hold.

Usage:

ClickButton buttonObject(pin [LOW/HIGH, [CLICKBTN_PULLUP]]);

where LOW/HIGH denotes active LOW or HIGH button (default is LOW) CLICKBTN_PULLUP is only possible with active low buttons.

Returned click counts:

  • A positive number denotes the number of (short) clicks after a released button.
  • A negative number denotes the number of "long" clicks.

Set a release callback:

To receive a callback whenever a button is released after a long press, set a callback:

void releaseCallback() {
	Serial.println("The button is released!");
}

void setup() {
	buttonObject.setReleaseCallback(releaseCallback);
}

About

A button library that handles multi-clicks, long clicks and click-and-hold

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C++ 100.0%