-
• #2
Yes, definitely - you just need some code a bit like the following:
var kb = require("ble_hid_keyboard"); NRF.setServices(undefined, { hid : kb.report }); var keyTimeout, keyClicks = 0; function onClick(count) { if (count==1) { // kb.tap(kb.KEY["7"], kb.MODIFY.ALT|kb.MODIFY.CTRL); digitalPulse(LED1,1,100); // red } else if (count==2) { // kb.tap(kb.KEY[8], 0); digitalPulse(LED2,1,100); // green } else if (count==3) { // kb.tap(kb.KEY[9], 0); digitalPulse(LED3,1,100); // blue } else { // some other number? } } setWatch(function() { keyClicks++; if (keyTimeout) clearTimeout(keyTimeout); keyTimeout = setTimeout(function() { keyTimeout = undefined; onClick(keyClicks); keyClicks=0; }, 500); }, BTN, {repeat:true, debounce:20, edge:"rising"});
That uses a 500ms (1/2 second) delay - so your multiple clicks have to be faster than that. It's easy enough to change though.
Hi there,
It can be possible to puck do the following:
Many regards,