Main Site Documentation

Float <-> byte[]?


I know that this was brought up a few months ago, but it was flagged as “being looked into”.

There is no was to convert a float to a byte array or a byte array to a float.

I’m sending data to the PC over bluetooth and currently I have to convery all my values to string and that is clogging my link, as well as preventing me from using fixed length fields/messages.

converting values to byte arrays is essential when talking to hardware. I know about the GHI function to convert int to byte array, but that is also very easily done with shifting. Float isn’t converted so easily. If if I can just do a mem copy then I will have the four bytes…

Is where any way to get to the underlying storage to read the 4/8 bytes?


Thats what you should use.


Ouch. For some reason I was under the impression that the Util class was for Int32/Int64. I’m sure I saw that on the forum somewhere.

Anyway. Thanks!

Now I can also write floats to my PID co-processor that I want to implement in a PIC18.