I am looking for built-in C or C++ function that allows me to convert a float into an HEX string, so far I have used itoa
, but it does not work with negative values since it works with unsigned for base 16, so I was wondering which one I could use instead that may handle the negative value.
Using itoa I loose my negative value as it can be seen below,
Acceleration X: -9 | X angle: **-0.5156689167**
Acceleration Y: -69 | Y angle: **-3.9565520286**
Acceleration Z: 986 | Z angle: 80.4013519287
Value of ACC per axe (x,y,z) in HEX ->ffcdfe751f68
Data to be send x ->**ffcd**
Data to be send y ->**fe75**
Data to be send z ->1f68
What other function could I use with the same functionality?