I’m using the Brickpi image. Sensor is Temp and humidity sensor.
I modified the grove_dht_pro.py for dht as follows
===================================================================================
GrovePi + Grove Temperature & Humidity Sensor Pro
http://www.seeedstudio.com/wiki/Grove_-_Temperature_and_Humidity_Sensor_Pro
import grovepi
Connect the Grove Temperature & Humidity Sensor Pro to digital port D4
SIG,NC,VCC,GND
sensor = 7
while True:
try:
[temp,humidity] = grovepi.dht(sensor,0) <------------- using 0 instead of 1
print “temp =”, temp, " humidity =", humidity
except IOError:
print "Error"
=============================================================================
On running this, getting following log…
temp = 25.0 humidity = 46.0
temp = 25.0 humidity = 46.0
temp = 26.0 humidity = 46.0
temp = 26.0 humidity = 46.0
temp = 25.0 humidity = 46.0
temp = 26.0 humidity = 46.0
temp = 25.0 humidity = 46.0
temp = 25.0 humidity = 46.0
IOError
Traceback (most recent call last):
File “tarak_dht.py”, line 12, in <module>
[temp,humidity] = grovepi.dht(sensor,0)
TypeError: ‘int’ object is not iterable
What is the reason of IOError ? How to fix this?