As I understood it, you weren't really meant to do:
1815
2A56
2A56
But instead might have different services that contained the same characteristic:
1815
2A56
1816
2A56
However I could well be wrong - is your example something that people are actually doing?
As you noted, in Espruino it's not easy to do. One solution is to alternate between using Strings and Integers:
NRF.setServices({
0x1815: { // automation
0x2A56: { // digital
readable: true,
value : 1,
},
"0x2A56" { // digital --> gets ignored as it's a duplicate key
readable: true,
value: 0
},
// could use `"0x2a56"` and `2A56` as well in this case...
}
});
However it is a bit of a hack! It'll also be virtually impossible to then change the value with NRF.updateServices at a later date as well.
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 I understood it, you weren't really meant to do:
But instead might have different services that contained the same characteristic:
However I could well be wrong - is your example something that people are actually doing?
As you noted, in Espruino it's not easy to do. One solution is to alternate between using Strings and Integers:
However it is a bit of a hack! It'll also be virtually impossible to then change the value with
NRF.updateServices
at a later date as well.