Created
November 11, 2019 19:49
-
-
Save NielsLeenheer/ee0ea2cf747b6759152b2b548ec15747 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var kb = require("ble_hid_keyboard"); | |
var services = { | |
0x180a: { | |
0x2a50: { | |
value: [ | |
0x01, /* Use USB Vendor IDs */ | |
0xac, 0x05, /* Apple */ | |
0x5a, 0x02, /* Internal Keyboard */ | |
0x00, 0x00 | |
], | |
readable: true, | |
} | |
} | |
}; | |
NRF.setServices(services, { | |
advertise: [ 0x180a ], | |
hid: kb.report | |
}); | |
function btnPressed() { | |
LED1.write(true); | |
setTimeout(function() { | |
LED1.write(false); | |
}, 200); | |
NRF.sendHIDReport([0, 0, kb.KEY.RIGHT, 0, 0, 0, 0, 0], function() { | |
NRF.sendHIDReport([0, 0, 0, 0, 0, 0, 0, 0]); | |
}); | |
} | |
setWatch(btnPressed, BTN, { | |
edge: "rising", | |
repeat: true, | |
debounce: 50 | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment