Page 1 of 1

[SOLVED] Teensy 'Bounce'

Posted: Sat Nov 04, 2017 4:21 am
by FrenchPaul
I have just finished my first GBZero build, but am having a small problem with the Teensy controller.

Sometimes when I press a button it registers as more than 1 press. Sometimes 2 or 3.
I have read on another thread that it helps to adjust the bounce value in Wermys code but unfortunately I don't know much about Arduino coding!
Can anyone tell me exactly which value I need to increase please?

Any help would be appreciated.
Below is a snapshot of Wermys code that i'm using, it mentions Bounce a couple of times but i'm not sure which value I need to increase.

Thanks.

Re: Teensy 'Bounce'

Posted: Sat Nov 04, 2017 4:39 am
by snoek09
In this line:

Code: Select all

ret->bounce = new Bounce(pin, 10);
increase the 10 value. I changed it to 100.

More info: https://www.pjrc.com/teensy/td_libs_Bounce.html
Bounce myButton = Bounce(pin, milliseconds);

Create a Bounce object called myButton, using "pin" and waiting for bouncing to end within "milliseconds" time.

Re: Teensy 'Bounce'

Posted: Sat Nov 04, 2017 5:04 am
by FrenchPaul
Thank you!
I thought that was the value I needed to change but just wanted to check.

Re: Teensy 'Bounce'

Posted: Sat Nov 04, 2017 6:14 am
by FrenchPaul
Thanks snoek09, just tried and it's now working perfectly!

Re: Teensy 'Bounce'

Posted: Sat Nov 04, 2017 7:18 am
by YaYa
Don’t forget to put [solved] on the topic’s title