Advertisement
Guest User

Untitled

a guest
Apr 9th, 2020
157
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.31 KB | None | 0 0
  1. pi@raspberrypi:~ $ cat Temp.py
  2. import Adafruit_DHT
  3. import time
  4.  
  5. DHT_SENSOR = Adafruit_DHT.DHT11
  6. DHT_PIN = 4
  7. humidity, temperature = Adafruit_DHT.read(DHT_SENSOR, DHT_PIN)
  8. if humidity is not None and temperature is not None:
  9.     print("{0:0.1f},{1:0.1f}".format(temperature,humidity))
  10. else:
  11.     print("-1,-1");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement