My friend ended up helping me out. Heres the code I got to work. Posting it here for anyone who needs it.
var kb = require("ble_hid_keyboard"); NRF.setServices(undefined, { hid : kb.report }); function btnPressed() { // Send 'CAPSLOCK' NRF.sendHIDReport([0, 0, kb.KEY.CAPS_LOCK, 0, 0, 0, 0, 0]); } function btnDepressed() { // Send 'None' NRF.sendHIDReport([0, 0, 0, 0, 0, 0, 0, 0]); } // trigger btnPressed whenever the button is pressed setWatch(btnPressed, BTN, {edge:"rising",repeat:true,debounce:50}); // trigger btnDepressed whenever the button is released setWatch(btnDepressed, BTN, {edge:"falling",repeat:true,debounce:50});
@user155924 started
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.
My friend ended up helping me out. Heres the code I got to work. Posting it here for anyone who needs it.