A float is just 4 bytes of binary data that is coded to show the decimal point
position and the number before and after the point. The trick is that you have
to tell the C++ compiler that you are not making a stupid mistake and really do
want to treat the float as an array of bytes:
void send_float (float f)
{
// Cast float to a pointer to bytes - Tells C++ you really mean to do that.
byte* bytes = (byte*)&f;
// write the data to the serial
Serial.write (bytes, sizeof(f));
}
--
For more options, visit http://beagleboard.org/discuss
---
You received this message because you are subscribed to the Google Groups
"BeagleBoard" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.