File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11import time
22import board
3+ import microcontroller
34import displayio
45import busio
56from analogio import AnalogIn
@@ -338,11 +339,11 @@ def switch_view(what_view):
338339
339340 if adt : # Only if we have the temperature sensor
340341 tempC = round (adt .temperature )
341- tempF = tempC * 1.8 + 32
342- sensor_data . text = 'Touch: {} \n Light: {} \n Temp: {}°F' . format ( touch , light , tempF )
342+ else : # No temperature sensor
343+ tempC = round ( microcontroller . cpu . temperature )
343344
344- else : # No temperature sensor on Titano and Pynt
345- sensor_data .text = 'Touch: {}\n Light: {}' .format (touch , light )
345+ tempF = tempC * 1.8 + 32
346+ sensor_data .text = 'Touch: {}\n Light: {}\n Temp: {}°F ' .format (touch , light , tempF )
346347
347348 # ------------- Handle Button Press Detection ------------- #
348349 if touch : # Only do this if the screen is touched
You can’t perform that action at this time.
0 commit comments