Closed lopatoid closed 5 years ago
Well, the library works totally fine for me. You either have a very crappy button, or done something wrong. By the way, I'm using it with a ky40 rotary encoder with press button, and decoding the rotation with the help of this library. Again, it works fine.
@lopatoid you most likely have a wiring issue, a faulty button, or the debounce period on that button is much larger than 100ms. I agree with @RedyAu; this library works when you have good hardware and follow the examples.
Library works, but it's buggy. And it doesn't matter if I have a crappy button -- I mean if library fails if using crappy button, it's still a bug. Anyway I released my own drop-in replacement for this library, so it's pretty easy to migrate to more stable solution. And for new projects it's better to use mature and in active development JC_Button library
Looking over your source code I'm assuming because you are now debouncing isPressed()
; that was probably your original issue.
I wrote these libraries, published them for free, provide free hosting, and support them for free. That's kind of why it took so long for me to respond.
I realize I'm a little late to the party - responding to your github issue long after you submitted it, however, you come off as a jerk by tagging my library in your source code (from 3 hours ago) as "buggy" and pushing people away from this library in your comments by recommending something else.
That's not how open-source contributions are supposed to work. The RBD::Timer
library had some critical issues when I release it 4 years ago and people in the Arduino community politely worked with me to sort out the issues. This would have been a different story if they just called me out for "buggy" software, published their own forked and renamed version, and tagged me as "buggy" in their repos.
Do you see how your actions kind of come off as having poor intentions?
Library works, but it's buggy.
What exactly does that mean? It does exactly what it is supposed to - debounces a button - but it is buggy? Can you please elaborate? Have you tried other buttons or types of buttons? Can we pinpoint exactly what issue you are having?
I run original code from your example without any modification. It doesn't work as expected if you press the button fast enough. You can't expect that button can be released several times without pressed first, it's just nonsense. Anyway #6 is closed by you because you don't admit the bug so I was forces to write and release my own drop-in replacement.
, published them for free, provide free hosting, and support them for free.
So I don't demand anything, I fully understand what free (as a free beer) means.
Thank you for bringing this issue to my attention (and following-up to make sure I could reproduce the issue). I did find the same issue with the library and example where if you quickly hit a button it would trigger multiple "Button Released" events without any associated "Button Pressed" events. After reviewing your project I also identified that isPressed()
and isReleased()
were not debounced in this library.
Both of these issues have been addressed in the latest version of this library (v2.2.0).
This library has very serious issues. Run push_button example from RBD_Button library and just press pushbutton attached to pin 2 frequently. You'll see: What? Button released more times than pressed! It's definitely a bug and it's critical. I mean this library doesn't do the only thing it's supposed to do.
Ok, lets add button.setDebounceTimeout(100); to setup() section to increase debounce time. Push button again several times. Whoa, in this example onRelease sometimes not working at all. Probably same bug, just different test case.