I am having an issue with trying to change the G values from the accelerator from int to float. When I simply change the variable type from int to float, it's serial output looks like this while sitting still:
-26844 -17153 -26844
mph/s: -0.17
-20133 -17217 -26844
mph/s: -0.17
-26844 -17153 -26844
mph/s: -0.17
-20133 -17217 -26844
mph/s: -0.17
-20133 -17217 -26844
mph/s: -0.17
-20133 -17217 -26844
mph/s: -0.17
-20133 -17217 -26844
mph/s: -0.17
While when it's just a plain int variable type, it looks normal:
0 0 1
mph/s: 0
0 0 1
mph/s: 0
0 0 1
mph/s: 0
0 0 1
mph/s: 0
0 0 1
mph/s: 0
0 0 1
mph/s: 0
However, I require the float version of the G values so that I can get an accurate calculation of the mph/s.
EDIT: The full code has been removed for confidential reasons.
//we send the x y z values as a string to the serial port
sprintf(str, "%d %d %d", xg, yg, zg);
Serial.print(str);
Serial.write(10);
Serial.print("mph/s: ");
Serial.println(mphs);
//It appears that delay is needed in order not to clog the port
delay(15);
}