Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Grove Temperature & Humidity Sensor Pro Python script
# Press [Ctrl]+[C] to terminate the program
import seeed_dht
sensor = seeed_dht.DHT(seeed_dht.DHT.DHT_TYPE["DHT22"], 12) # DHT type 22, pin 12
while True:
humi, temp =
print('DHT{0}, humidity {1:.1f}%, temperature {2:.1f}C'.format(sensor.dht_type, humi, temp))
except KeyboardInterrupt:
print("Exiting program.")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment