-
Notifications
You must be signed in to change notification settings - Fork 170
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Does #define BOUNCE_LOCK_OUT work? #85
Comments
I updated the Wokwi Simulation at https://wokwi.com/projects/324855073217708626 to produce a simulated noisy square wave and saw no difference between the #define BOUNCE_LOCK_OUT and not. With a commented-out
With
|
Hello @drf5n I tested with the following simpler example : https://wokwi.com/projects/327380656345580114 I tested with the simulator and in reality. With a real circuit everything works. With the simulator, there seems to be a bug with Wokwi where the To answer you initial question : Yes, #define BOUNCE_LOCK_OUT works. |
Thank you. I raised an issue over on the simulator: wokwi/avr8js#121 |
It isn't just the simulator -- it doesn't do it my Arduino 1.8.19 I tried this copy of bounce_basic.ino on a mega with a 5000ms interval and
It works if I edit .../libraries/Bounce2.h and uncomment the #define BOUNCE_LOCK_OUT line, but if I put a #define BOUNCE_LOCK_OUT into my sketch it does not. If I put an
defining the flag in the sketch https://github.com/thomasfredericks/Bounce2/blob/master/examples/bounce_basic/bounce_basic.ino doesn't trigger the error but defining the flag in Bounce2.h does trigger it. I think the method works, but is not enabled by a #define in the sketch as described in the docs with "(or in your code before including "Bounce.h") " |
Remove "(or in your code before including "Bounce.h") " per thomasfredericks#85 (comment) -- it only seems to work if defined in the Bounce2.h file. Perhaps it is related to https://forum.arduino.cc/t/order-of-include-files/36881/4 and https://arduino.github.io/arduino-cli/dev/sketch-build-process/ I would suppose that the "#define BOUNCE_WITH_PROMPT_DETECTION" would also only work in the .h file.
I was trying it in Wokwi as
https://wokwi.com/projects/324855073217708626
and didn't see that it had an effect.
The documentation at https://github.com/thomasfredericks/Bounce2#lock-out-interval says
but it does not seem to have an effect.
Output from that script's simulation:
Some discussion at https://forum.arduino.cc/t/leading-edge-debouncing/964407/15
The text was updated successfully, but these errors were encountered: