Page 1 of 1

Display Characteristic Value as a Number?

Posted: 16:47, 16 Sep 2015
by biczak
I am trying to take a specific characteristic, and display its value, which is a number. Currently, my app is able to connect to the device, but it displays the characteristic's UUID instead of it's numerical value. Is it possible with JavaScript to take the characteristic's UUID and from that display the value that characteristic represents?

Re: Display Characteristic Value as a Number?

Posted: 13:11, 22 Sep 2015
by Fredrik
It is possible.

You'll need to call readCharacteristic() and wait for a reply from the remote device.

The reply has the type ArrayBuffer. You'll need to interpret it in the format of your number. There's a lot to choose from. Decimal string or binary? 8-bit, 16-bit or 32-bit? Big or little endian?

Here's an example that uses Uint8Array: