Hi! Since you're using a Puck, the pin names are a bit different (starting with D... and not Ax/Bx/etc) but yes what you're suggesting is fine apart from that.
I'd say just connect a button between maybe pin D1 and the 3v pin (this means you don't need digitalWrite(A6, 1);/similar because the pin is already at a voltage).
Then it's just:
pinMode(D1, 'input_pulldown');
setWatch(function(e) {
controls.playpause(); // or whatever else you want to do
}, D1, { repeat: true, edge: 'rising', debounce: 50 });
// your other HID code here...
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.
Hi! Since you're using a Puck, the pin names are a bit different (starting with
D...
and notAx/Bx/etc
) but yes what you're suggesting is fine apart from that.I'd say just connect a button between maybe pin
D1
and the3v
pin (this means you don't needdigitalWrite(A6, 1);
/similar because the pin is already at a voltage).Then it's just: