Switch Debounce

How is the gpiopin.DebounceTimeout implemented ? How to use it ?

gpio.DebounceTimeout = TimeSpan.FromMilliseconds(100);

internally, what does it do? Is it the length of time between first change to when the ‘actual’ read takes place?

for a start, it will be processor dependent. And second, it should be circuitry and switch hardware dependent. So you’re chasing the wrong thing here - as Dat says, use the debounce timeout for what it is, try it, but it’ll be a compromise and you need to handle it better in your own software once you understand how your switches behave…

That is what I am asking - what is it. On other systems, I handled debounce by starting a timer on first value change and when the time elapsed read the value again and use that as the value of the switch.

that code sounds perfectly feasible here. That is not the switch debounce the processor may expose… I’d just do your own

I did some more testing. I set the debouncetimeout to 2 millisec and it seemd to work

I would expect debounce to ignore any changes that happen in a shorter time than the minimum specified.

What about longer then specified, if I set it to 200ms I don’t get double fire, but when I press the key wait for more then 200ms to release I get double fire, how to avoid that?

DriveMode is InputPullup and checking only on FallingEdge

We have an issue to look into this. Debounce is not perfect today.