I am looking for direction with the following scenario:
I have an external temperature sensor. I need a script that will read the temperature of the sensor every 10 seconds, and if the temperature is over a certain degree F, will trigger a GPIO pin, which will in turn trigger my relay to run cooling fans. When the temperature drops below this threshold, I would like the GPIO pin to return to normal to deactivate my trigger. Seems easy enough, but all the tutorials I have found either deal with the internal CPU or is not complete. Would someone be so kind to help me with this code?
Hopfully this is a start:
import os, glob, time
base_dir = '/sys/bus/w1/devices/'
device_folder = glob.glob(base_dir + '28*')
device_file = device_folder + '/w1_slave'
f = open(device_file, 'r')