Merge pull request #1090 from dglaude/patch-1

rounding temperature as last operation
This commit is contained in:
Dan Halbert 2020-04-25 11:33:51 -04:00 committed by GitHub
commit fc3d00471d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -338,12 +338,12 @@ while True:
light = light_sensor.value
if adt: # Only if we have the temperature sensor
tempC = round(adt.temperature)
tempC = adt.temperature
else: # No temperature sensor
tempC = round(microcontroller.cpu.temperature)
tempC = microcontroller.cpu.temperature
tempF = tempC * 1.8 + 32
sensor_data.text = 'Touch: {}\nLight: {}\n Temp: {}°F'.format(touch, light, tempF)
sensor_data.text = 'Touch: {}\nLight: {}\n Temp: {:.0f}°F'.format(touch, light, tempF)
# ------------- Handle Button Press Detection ------------- #
if touch: # Only do this if the screen is touched