Hi everybody, i'm trying to receive signal from the Xsens Mti IMU device connecting it to my Arduino Mega2560 board. For now i've found some topics on it but maybe it's not what i need.
I've uploaded this code on the board:
void setup()
{
Serial.begin(115200);
// prints title with ending line break
Serial.println("Floats coming out as bytes!!");
// wait for the long string to be sent
delay(100);
}
float myVelocity = 0.0;
union u_tag {
byte b[4];
float fval;
} u;
void loop()
{
u.fval = myVelocity;
Serial.print("Byte 1: ");
Serial.println(u.b[0], DEC );
Serial.print("Byte 2: ");
Serial.println(u.b[1], DEC );
Serial.print("Byte 3: ");
Serial.println(u.b[2], DEC );
Serial.print("Byte 4: ");
Serial.println(u.b[3], DEC );
Serial.println();
myVelocity += 1.0;
delay(100); // allow some time for the Serial data to be sent
}
The output that i receive on the Serial Monitor is a sequence of strange symbols that would be unreadable for anyone.
What is the problem in my code? How can I receive the right signal reading a comprehensible message?
Thank you everyone for helping me!
VZ