JChristensen / JC_Button

Arduino library to debounce button switches, detect presses, releases, and long presses
GNU General Public License v3.0
425 stars 102 forks source link

Added Multiple Quick Press Detection #31

Closed Kuantronic closed 2 years ago

Kuantronic commented 3 years ago

Added the multiPressRead() function to the library. It checks the time between different presses on the same button. If the press is quick enough, it counts as a successive multi-press. Think of the audio control in Apple's wired EarPods headphones. It detects single press to resume/pause, double press to skip forward, and triple press to skip backward.

Updated the README file and added an example ino file to showcase this new feature.

Have tested the code myself and found no bug or error as of yet.

marmilicious commented 3 years ago

Thank you @Kuantronic I tried it out, nice addition. :)

Kuantronic commented 3 years ago

Thank you @Kuantronic I tried it out, nice addition. :)

Glad that you liked it! It was a feature I wanted in the past but wasn't available until I did something about it.

marmilicious commented 3 years ago

@Kuantronic Indeed, me too (from long ago ).

Kuantronic commented 3 years ago

@Kuantronic Indeed, me too (from long ago ).

Oh didn't know this was a requested feature for that long. Just discovered this library only about 6 months ago and realized I needed the multi-press/click feature like 2 month ago. Surprised that no one else did it before me in that time.

BrianEstrada commented 2 years ago

Seems like maybe this library has been abandoned? @JChristensen

Kuantronic commented 2 years ago

Seems like maybe this library has been abandoned? @JChristensen

Possibly. You can just download my version of the library if you need the multi-press function.

JChristensen commented 2 years ago

Not abandoned, but I don't get much time to look at PRs. I have to pass on this one, thanks anyway.