Detect Button Press

Challenge 2

Reading the instantaneous value of a button is easy (see the getting started docs) but how do you deal with debouncing so it’s reliable?

What about more than one button being pressed at the same time?

Help is at hand on the Espruino site.

Buttons are a great example of how you write event-driven code with Espruino rather than the more traditional read-loops that people starting on Arduino tend to use.