In another post about the LED and button tutorial, the following was stated:
setWatch can be called like setWatch(swap_on_down, BTN1,
{repeat:true,edge:"rising"}); so that it only calls your swap_on_down
function when the button becomes pressed.
I used that code but sometimes when I press the button once, my function gets called twice. I thought maybe I was being careless and tried very carefully to press and release it without any hesitation. I found that, no matter how careful I was, sometimes the function would get called once and sometimes 2-3 times. I changed the code to use "falling" instead and it seems to work reliably - the function only gets called once per button press.
Has anyone else experienced this behavior? Perhaps there is a bug? Is the switch debouncing implemented in hardware or software with Espruino?
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.
In another post about the LED and button tutorial, the following was stated:
I used that code but sometimes when I press the button once, my function gets called twice. I thought maybe I was being careless and tried very carefully to press and release it without any hesitation. I found that, no matter how careful I was, sometimes the function would get called once and sometimes 2-3 times. I changed the code to use "falling" instead and it seems to work reliably - the function only gets called once per button press.
Has anyone else experienced this behavior? Perhaps there is a bug? Is the switch debouncing implemented in hardware or software with Espruino?