Skip to content

acropup/OneButton

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

47 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Arduino OneButton Library

This fork of Matthias Hertel's OneButton Library is functionally similar, except the code has been refactored to use an Enum and switch statement as a state machine, and many of the trivial class members are made public, thus reducing the library's code size by ~30%. The result for users of the library is that if you previously wrote this:

button.attachDoubleClick(doubleclick);

You should now write this:

button.onDoubleClick = doubleclick;

This Arduino libary is improving the usage of a singe button for input. It shows how to use an digital input pin with a single pushbutton attached for detecting some of the typical button press events like single clicks, double clicks and long-time pressing. This enables you to reuse the same button for multiple functions and lowers the hardware invests.

This is also a sample for implementing simple finite-state machines by using the simple pattern above.

You can find more detail on this library at https://www.mathertel.de/Arduino/OneButtonLibrary.aspx

About

An Arduino library for using a single button for multiple purpose input.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C++ 100.0%