My name is Luke, and I am trying to get the temperature and humidity sensor pro working on my raspberry pi, via the GrovePi0. I used the guide found here under the section titled “Play With Raspberry Pi (with GrovePi_Plus)”. I modified the value of blue to white since we’re using a pro and not the regular model, and changed the port value from 4 to 3. However, when I run the python script, it starts, and then outputs no values. I can’t find this error anywhere else online, so maybe you guys can help.
[code]
import grovepi
import math
Connect the Grove Temperature & Humidity Sensor Pro to digital port D4
This example uses the blue colored sensor.
SIG,NC,VCC,GND
sensor = 3 # The Sensor goes on digital port 4.
temp_humidity_sensor_type
Grove Base Kit comes with the blue sensor.
blue = 0 # The Blue colored sensor.
white = 1 # The White colored sensor.
while True:
try:
# 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,white)
if math.isnan(temp) == False and math.isnan(humidity) == False:
print(“temp = %.02f C humidity =%.02f%%”%(temp, humidity))
except IOError:
print ("Error")
<e>[/code]</e></CODE></r>