diff --git a/Scripts/temperature-sensor.py b/Scripts/temperature-sensor.py index fd41a55..73cadc7 100644 --- a/Scripts/temperature-sensor.py +++ b/Scripts/temperature-sensor.py @@ -9,11 +9,11 @@ print('Found DS devices: ', roms) while True: ds_sensor.convert_temp() time.sleep_ms(750) - for rom in roms: + for rom in roms: # in a loop to get each sensor on the same pin since you can have multi sensors print(rom) tempC = ds_sensor.read_temp(rom) - tempF = tempC * (9/5) +32 - print('temperature (ºC):', "{:.2f}".format(tempC)) + tempF = tempC * (9/5) +32 # convert to farenheit + print('temperature (ºC):', "{:.2f}".format(tempC)) # The result will have two decimal places {:.2f} print('temperature (ºF):', "{:.2f}".format(tempF)) print() - time.sleep(5) \ No newline at end of file + time.sleep(5) # the loop will repeat every 5 seconds \ No newline at end of file