You are here

Transmitting FLOAT data | Cypress Semiconductor

Transmitting FLOAT data

Summary: 1 Reply, Latest post by PRKU on 06 Aug 2015 02:57 AM PDT
Verified Answers: 0
Last post
Log in to post new comments.
user_463452230's picture
6 posts

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



PRKU's picture
Cypress Employee
26 posts

moved from PSoC 4 Architecture to PSoC 4 BLE


Log in to post new comments.