Help with Gatt data

Hi guy

I'm trying to make sense of the Gatt data i get back from (accelerometer data):

gatttool -i hci1 -b F8:85:11:7C:70:EF -t random --char-read -a 0x001f
Characteristic value/descriptor: 03 04 07 fb fa 06 f3 43 

How would I convert those values to floats?

Cheers

Gadget

Comments

  • The XYZ values start in position 2 and are packed: XX YY ZZ.  So in your response, the corresponding values would be:

    X= 0xfb07
    Y= 0x06fa
    Z= 0x43f3

    These values are interpreted as an int16_t and need to be divided by a scale to obtain the g value as a float.  If you're using a MetaWear R board, the scale is 1000.  On RG/C boards, the scale depends on what the acceleration range is.

    You can check out the relevant C++ code in the datainterpretor class.




This discussion has been closed.