树莓派IIC通讯,读取SHT4X IC,返回温湿度,例子已封装可以直接调用,欢迎参考!
#use this function can get temperature and huminity
def Measuring_Temperature_Huminity(self,Mode=[0xFD]):
R_data=self.SHT4X_read(Mode)
crc_Temp=[R_data[0],R_data[1]]
crc_Humi=[R_data[3],R_data[4]]
if (self.SHT4X_ReturnData_Crc(crc_Temp)==R_data[2])&(self.SHT4X_ReturnData_Crc(crc_Humi)==R_data[5]):
temperature=round(((R_data[0]*256+R_data[1])/(2**16-1))*175-45,1)
humidity=round(((R_data[3]*