I have got troublesome problem during writing some code on arduino. I am trying to send serial floating number to Arduino Mega from Simulink Instrumental Control Toolbox(To instrument block) and process this floting number inside Arduino and get floating number result, and after that send back the result as floating number back to Simulink environment through Query instrument(Serial receive)
In order to do that, I set sending and receiving parts parameters as: format binary and precision 32 bits float with 9600 baudrate. On Arduino I intend to read four bytes which yields to 32 bits inside a for loop and convert them to integer bits as depicted below.
My question is there are various examples are already implemented on programming languages like java and processing that binery to floating number conversions are realized by
float f = Float.intBitsToFloat(number)
How can i realize the same conversion on Arduino IDE. I appreciate your contributions and efforts. Thanks in advance.
Thank you very much i got the point on reading bytes issue. But i got one more question. Sorry for my lack of programming knowledge. How can I interprete binary data that i have previously converted from float data, to float data again on arduino. Suppose that ? have read 32 bit data. How could I convert to float again. :). I mean how to realize Float.intBitsToFloat code on Arduino or other algorithm which is identical. You know that this code is working on Processing, Java, etc.. languages. I really appreciate your efforts. Thanks alot.