My project revolves around calculating an electric longboards velocity. The current setup is simplified to where both the RPM and Wheel Diameter variables are characteristics of my main service, velocityService.The three characteristics look like this:BLEUnsignedCharCharacteristic rpmCharacteristic("19B10011-E8F2-537E-4F6C-D104768A1214", BLERead | BLEWrite);BLEUnsignedCharCharacteristic diameterCharacteristic("19B10012-E8F2-537E-4F6C-D104768A1214", BLERead | BLEWrite);BLEDoubleCharacteristic velocityCharacteristic("19B10013-E8F2-537E-4F6C-D104768A1214", BLERead | BLEWrite);My current problem is that RPM will be a 4-byte number, Diameter will be 2 or 3 bytes, and velocity will need to be a fraction of up to 6 bytes in length.Every time I set the third argument, maxLen, to any value it gives me this error: no matching function for call to 'BLEUnsignedCharCharacteristic::BLEUnsignedCharCharacteristic(const char , int, int)' I need to be able to modify this because when I edit the value of the RPM characteristic it leaves me with only the first two bytes of information. For instance, writing 3200 to the RPM characteristic then reads 32. So the velocity is way lower than expected.I need to be able to output velocity to my i-phone as a fraction.So I tried using BLEDoubleCharacteristic velocityCha........ but its output makes no sense to me. And I could not convert it to decimal to check its accuracy.The app I am using, nrf connect, does not convert the hex to decimal values. So for instance, if the Arduino is trying to tell me that velocity is 25.89 I would instead read a hex number. And I have not found an online calculator to translate hex to decimal especially when the app value doesn't specify a decimal point. For ex. 30.1 = 0x9A99999999193E40. And I have no idea how to go from that back to 30.1.So to sum up what I am failing to understand:How to make a characteristic of a greater lenght than 2 bytes.And how to send fractions or non integers accross my BLE connection.I am using an Arduino 101, with the Curie stuff installed.
Hi @Atledbet_11 Float and double characteristic values are sent as IEEE 754 representation, please see: https://en.wikipedia.org/wiki/Single-precision_floating-point_format#IEEE_754_single-precision_binary_floating-point_format:_binary32 or https://en.wikipedia.org/wiki/Double-precision_floating-point_format#IEEE_754_double-precision_binary_floating-point_format:_binary64
By default, CurieBLE will use little endian format, the tool you are using most likely displays values as big endian. "characteristic.setValueBE(...)" can be used to set the value in big endian format.