Guest User

joghurt.py

a guest
Feb 20th, 2016
2,349
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.96 KB | None | 0 0
  1. import time
  2. import Adafruit_DHT
  3. import RPi.GPIO as GPIO
  4. GPIO.setmode(GPIO.BCM) # GPIO Nummern statt Board Nummern
  5. sensor = Adafruit_DHT.DHT22
  6. pin = 4
  7. RELAIS_1_GPIO = 17
  8. GPIO.setup(RELAIS_1_GPIO, GPIO.OUT)
  9.  
  10. counter=0
  11. mintemp=float(43.0)
  12. maxtemp=float(44.0)
  13.  
  14. szeit=time.time() # startzeit
  15. lzeit=25200 #laufzeit 7 std
  16. while time.time() < szeit+lzeit:
  17.     humidity, temperature = Adafruit_DHT.read_retry(sensor, pin)
  18.     temp= round(temperature,1)
  19.     if temp>maxtemp:
  20.         GPIO.output(RELAIS_1_GPIO, GPIO.LOW)
  21.     if temp<mintemp:
  22.         GPIO.output(RELAIS_1_GPIO, GPIO.HIGH)
  23.  
  24.     # Nur für Testlauf
  25.     # counter=counter+1
  26.     # print "durchgang", counter
  27.     # print "vergangene zeit", (time.time()-szeit)/60.0, "min"
  28.     # print "restzeit", (szeit+lzeit-time.time())/60.0, "min"
  29.     # print "temperatur:", temp
  30.     # print "tempmesswert:", temperature
  31.     time.sleep(30)
  32. GPIO.output(RELAIS_1_GPIO, GPIO.LOW)
  33.  
  34. GPIO.cleanup()
Advertisement
Add Comment
Please, Sign In to add comment