Guest User

joghurt.py

a guest
Feb 20th, 2016
1,887
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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()
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×