def read_temp():
global temp_f
lines = read_temp_raw()
while lines[0].strip()[-3:] != 'YES':
#time.sleep(0.2)
lines = read_temp_raw()
equals_pos = lines[1].find('t=')
if equals_pos != -1:
temp_string = lines[1][equals_pos+2:]
temp_c_raw = float(temp_string) / 1000.0
temp_f_raw = temp_c_raw * 9.0 / 5.0 + 32.0
temp_f = "{0:.0f}".format(temp_f_raw) #only whole numbers
#_________________________________________________________________
#VARIABLES
评论列表
文章目录