#Check sensors and log to file
from si7021 import getTempC, getHumidity
from logData import logData
from ds18B29 import getTempC as getTempC_ds

try:
    temp = getTempC()
    logData("si7921_top", "Success", "temperature", "{:10.1f}".format(temp), '')
except (IOError):    
        logData("si7921_top", "Failure", "temperature", '', '')

try:
    humid = getHumidity()
    logData("si7021_top", "Success", "humidity", "{:10.1f}".format(humid), '')
except (IOError):    
        logData("si7921_top", "Failure", "humidity", '', '')

Exemplo n.º 2
0
from si7021 import getTempC, getHumidity

print("***Test SI7021 Sensor***")
print ("Temperature in Celsius is : %.2f C" %getTempC())
print ("Relative Humidity is : %.2f %%" %getHumidity())
Exemplo n.º 3
0
#Check sensors and log to file
from logData import logData
from si7021 import getHumidity, getTempC
import NDIR

try:
    humidity = getHumidity()
    logData("si7021", "Success", "humidity", "{:10.1f}".format(humidity), '')
except (IOError):
    logData("si7021", "Failure", "humidity", '', IOError)

try:
    temp = getTempC()
    logData("si7021", "Success", "temperature", "{:10.1f}".format(temp), '')
except (IOError, e):
    logData("si7021", "Failure", "temperature", '', str(e))

try:
    sensor = NDIR.Sensor(0x4D)
    sensor.begin()
    logData("CO2 Concentration", "Success", "co2", str(sensor.getCO2()), '')
except (IOError):
    logData("CO2 Concentration", "Failure", "co2", '', str(IOError))