Hi, I am having an issue when calculating a simple subtraction. The result given is wrong.
When I do the operation inside the Serial.print() the result given is correct, however when doing it outside in order to use it the result is wrong. This is really strange, maybe Serial.print() does some sort of internal conversion, maybe someone with more programming knowledge can explain that to me.
int currentLoad = weightMeasureCalibration(i) - calibration[i]; Serial.print("\nCurrent load feet["); Serial.print(i); Serial.print("]: "); Serial.print(currentLoad); Serial.print("|"); Serial.print(currentLoad = weightMeasureCalibration(i) - calibration[i]); Serial.print("|"); Serial.print(currentLoad);
Printed result Current load feet: 30|-1|-1 Current load feet: -140|13|13 Current load feet: -10|-3|-3 Current load feet: 85|-8|-8
weightMeasureCalibration & calibration are int.