示例#1
0
from si7021 import getTempC, getHumidity

print("***Test SI7021 Sensor***")
print ("Temperature in Celsius is : %.2f C" %getTempC())
print ("Relative Humidity is : %.2f %%" %getHumidity())
from thermostat import adjustThermostat
from si7021 import getTempC
from logData import logData

try:
    temp = getTempC()
    adjustThermostat(temp)  
except (IOError):
    print("Failure to get temperature, no sensor found; check pins and sensor")
    logData("si7921-top", "Failure", "temperature", "", "Sensor not found")