function SetupServices() {
NRF.setServices({
0xBCDE: {
0xABCD : {
value : "Hello", // optional
maxLen : 25, // optional (otherwise is length of initial value)
broadcast : true, // optional, default is false
readable : true, // optional, default is false
writable : true, // optional, default is false
notify : true, // optional, default is false
indicate : true, // optional, default is false
description: "My Characteristic", // optional, default is null
onWrite : function(evt) { // optional
console.log("Got ", evt.data);
}
}
// more characteristics allowed
}
// more services allowed
});
}
SetupServices();
var cnt = 0;
setWatch(function() {
if(cnt++ % 2 === 0)
LED1.set();
else
LED1.reset();
NRF.updateServices({
0xBCDE : {
0xABCD : {
value : [cnt],
notify: true
}
}
});
}, BTN, { repeat:true, edge:"rising", debounce: 50 });
Connecting via nRF Connect iPad app, I can see the service and Characteristic ABCD..
It's default value however shows as 0x0D and pressing the puck button (which does toggle the led) is not updating that value
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.
As another test, using this code on the puck
Connecting via nRF Connect iPad app, I can see the service and Characteristic ABCD..
It's default value however shows as 0x0D and pressing the puck button (which does toggle the led) is not updating that value