user4396: I would like to convert an array of bytes, received from serial, to a float.
Let's consider this exemple. I'm sending 0.12 byte-wise from an Android application. The conversion from float to array of bytes in the Android side is handled by this function
public static byte [] float2Bytes(float value)
    {
        return ByteBuffer.allocate(4)./*order(ByteOrder.LITTLE_ENDIAN).*/putFloat(value).array();
    }

When bytes arrive, they are stored in an array and the assembled.
hiBytew1 = bufferBytes[9];
//Serial.println(hiBytew1);
loBytew1 = bufferBytes[10];
//Serial.println(loBytew1);
hiBytew2 = bufferBytes[11];
//Serial.println(hiBytew2);
loBytew2 = bufferBytes[12];
//Serial.println(loBytew2);
float conAck = assemble(hiBytew1, loBytew1, hiBytew2,loBytew2);

How can I achieve this kind of conversion assuming that bytes are received in the correct order?

user368: Just cast the pointer.
float conAck = *((float*)(bufferBytes + 9));


4396: <p>I would like to convert an array of bytes, received from serial, to a float.</p>

<p>Let's consider this exemple. I'm sending 0.12 byte-wise from an Android application. The conversion from float to array of bytes in the Android side is handled by this function</p>

<pre><code>public static byte [] float2Bytes(float value)
    {
        return ByteBuffer.allocate(4)./*order(ByteOrder.LITTLE_ENDIAN).*/putFloat(value).array();
    }
</code></pre>

<p>When bytes arrive, they are stored in an array and the assembled.</p>

<pre><code>hiBytew1 = bufferBytes[9];
//Serial.println(hiBytew1);
loBytew1 = bufferBytes[10];
//Serial.println(loBytew1);
hiBytew2 = bufferBytes[11];
//Serial.println(hiBytew2);
loBytew2 = bufferBytes[12];
//Serial.println(loBytew2);
float conAck = assemble(hiBytew1, loBytew1, hiBytew2,loBytew2);
</code></pre>

<p>How can I achieve this kind of conversion assuming that bytes are received in the correct order?</p>
 368: <p>Just cast the pointer.</p>

<pre><code>float conAck = *((float*)(bufferBytes + 9));
</code></pre>
