• When you specify debounce it doesn't call your function until the button has stayed in the new state for the given number of milliseconds. The idea is to stop the function being called multiple times from one press - however because of the way the underlying hardware works, with very noisy buttons you can sometimes (although it's unlikely) get into the state where the button is pressed but during the last interrupt Espruino received, it was read as having been released.

    ... however, if you only care about whether the button has changed state then you don't have to care about that. You can effectively do your own debouncing by doing something when the button first changes state and then ignoring any extra changes for a fraction of a second.

About

Avatar for Gordon @Gordon started