KrisKasprzak
Well-known member
All,
I'm using an MPU605 with Teensy 3.2 and I'm trying to get the temp, which is returned in 16-bit 2's compliment. I've found some explanations on converting but my conversions are way off.
My MCU and MPU605 are currently at around 73 deg f and the MPU6050 is returning -2857 or so.
Anyone have some code to go from 16-bit 2's compliment to it's decimal?
I'm using an MPU605 with Teensy 3.2 and I'm trying to get the temp, which is returned in 16-bit 2's compliment. I've found some explanations on converting but my conversions are way off.
Code:
int16_t MPU6050::getTemperature() {
I2Cdev::readBytes(devAddr, (MPU6050_IMU::MPU6050_RA_TEMP_OUT_H), 2, buffer);
return (((int16_t)buffer[0]) << 8) | buffer[1];
}
My MCU and MPU605 are currently at around 73 deg f and the MPU6050 is returning -2857 or so.
Anyone have some code to go from 16-bit 2's compliment to it's decimal?