1 Reply Latest reply on Aug 6, 2015 2:57 AM by PraveenM_86

    Transmitting FLOAT data

      This might be more an Android programming question than PSoC but if anyone has experience with FLOAT data:




      Using a characteristic with Field, New Field, Type FLOAT, Length 4.


      As suggested here, the float is cast (void) on writing in PSoC:


                  notificationHandle.value.val = (void *)&Ah;




      In Android, reading it with     float c = getFloatValue(BluetoothGattCharacteristic.FORMAT_FLOAT, 0);


      only gets INFINITY.    The data is being transmitted, because if I get it as 4 bytes and convert to IEEE 32 bit float, it's correct (that was a two aspirin coding job for me;)




      03-25 19:11:43.158: D/BluetoothGattActivity(6732): AH Got 229,242,63,63

      in hex those are:  E5 F2 3F 3F

      AH should be around 0.752

      The above converts to:   0.749800026417