import grovepi import math from sensors.lock import grove_lock # Connect the Grove Temperature & Humidity Sensor Pro to digital port D3 # This example uses the blue colored sensor. # SIG,NC,VCC,GND sensor = 3 # The Sensor goes on digital port 3. # temp_humidity_sensor_type # Grove Base Kit comes with the blue sensor. blue = 0 # The Blue colored sensor. white = 1 # The White colored sensor. def get_temperature_and_humidity(): with grove_lock: [temp,humidity] = grovepi.dht(sensor,blue) if math.isnan(temp) == False and math.isnan(humidity) == False: return temp, humidity else: print("Error reading from DHT sensor") return None, None