我使用树莓派+lm92做温度检测,室温在25度左右,但是通过lm92得到的数据为29度
读取数据的主要代码:
#define I2C_ADDR 0x48 #include <linux/i2c-dev.h> static const char *device = "/dev/i2c-1"; uint8_t buffer[2]; fd = open(device, O_RDWR); ioctl(fd, I2C_SLAVE,I2C_ADDR); read(fd,buffer,2); data = buffer[0]; data = data << 8; data = data | buffer[1]; data = data >> 3; temperature = LM92_RES * data;