To detect a button press, you probably want edge:'rising'?
Are you using an up to date firmware? I know some earlier ones had issues with debouncing.
Also, is that the only code you're running? Could be be that the pin state on BTN (which is actually pin C13) could be being reset to a pure input somehow? By default it is in input_pulldown mode, which uses an internal resistor to stop it floating when the button isn't pressed.
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.
Sorry just read the title - this is on a Pico?
To detect a button press, you probably want
edge:'rising'
?Are you using an up to date firmware? I know some earlier ones had issues with debouncing.
Also, is that the only code you're running? Could be be that the pin state on
BTN
(which is actually pinC13
) could be being reset to a pure input somehow? By default it is ininput_pulldown
mode, which uses an internal resistor to stop it floating when the button isn't pressed.