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.
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
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.