When running the example code for the grove temp and hum sensor and raspberry pi, I only get zero values. At first I only got nans until I updated firmware, then started getting 0s. I’m using GrovePi+ with RaspberryPi 3.
I’ve tried different ports, changing the ‘blue’ to ‘white’ sensor in the code, and I am now at a loss. Also, when I simply unplug the sensor, I still get the same 0 values. I’m starting to think the sensor is faulty.
Any help is greatly appreciated! Here’s the code:
Connect the Grove Temperature & Humidity Sensor Pro to digital port D4
This example uses the blue colored sensor.
sensor = 4 # The Sensor goes on digital port 4.
Grove Base Kit comes with the blue sensor.
blue = 0 # The Blue colored sensor.
white = 1 # The White colored sensor.
# This example uses the blue colored sensor.
# The first parameter is the port, the second parameter is the type of sensor.
[temp,humidity] = grovepi.dht(sensor,blue)
if math.isnan(temp) == False and math.isnan(humidity) == False:
print(“temp = %.02f C humidity =%.02f%%”%(temp, humidity))
except IOError: print ("Error")