def CheckTemp(lower_limit,upper_limit): temp=WaterTemp() if temp>upper_limit: pin_ob=Pin() num=pin_ob.number("WaterTempH") print("WATER TOO HOT FOR PLANT") GPIO.setup(num, GPIO.OUT) GPIO.output(num, GPIO.HIGH) if temp<lower_limit: pin_ob=Pin() num=pin_ob.number("WaterTempL") print("Water is too cold") GPIO.setup(num, GPIO.OUT) GPIO.output(num, GPIO.HIGH)
#!/usr/bin/python # Author: Saizenki # Date: 14.08.2018 import RPi.GPIO as GPIO from AllPin import Pin pin_ob=Pin() pin=pin_ob.number("ExFan") print(pin) GPIO.setwarnings(False) GPIO.setmode(GPIO.BOARD) GPIO.setup(pin, GPIO.OUT) def FanOff(): #GPIO.output(pin, GPIO.HIGH) GPIO.cleanup() print("Exhaust Fan Off") FanOff()
#!/usr/bin/python # Author: Saizenki # Date: 14.08.2018 import RPi.GPIO as GPIO from AllPin import Pin pin_ob = Pin() pin = pin_ob.number("CirFan") GPIO.setwarnings(False) GPIO.setmode(GPIO.BOARD) GPIO.setup(pin, GPIO.OUT) def FanOn(): GPIO.output(pin, GPIO.LOW) print("Circulation Fan On") def FanOff(): GPIO.output(pin, GPIO.HIGH) print("Circulation Fan Off") GPIO.cleanup()
def __init__(self): pin_ob = Pin() num = pin_ob.number("Water_Level_Full") GPIO.setwarnings(False) GPIO.setmode(GPIO.BOARD) GPIO.setup(num, GPIO.IN)
#!/usr/bin/python # Author: Saizenki # Date: 14.08.2018 import RPi.GPIO as GPIO from AllPin import Pin name = "Led" pin_ob = Pin() pin = pin_ob.number(name) print(pin) GPIO.setwarnings(False) GPIO.setmode(GPIO.BOARD) GPIO.setup(pin, GPIO.OUT) def LedOn(): GPIO.output(pin, GPIO.LOW) print("Led is On") LedOn()
#!/usr/bin/python # Author: Saizenki # Date: 14.08.2018 import RPi.GPIO as GPIO from AllPin import Pin pin_ob = Pin() pin = pin_ob.number("AirPump") GPIO.setwarnings(False) GPIO.setmode(GPIO.BOARD) GPIO.setup(pin, GPIO.OUT) def AirPumpOn(): GPIO.output(pin, GPIO.LOW) print("Air Pump On") def AirPumpOff(): GPIO.output(pin, GPIO.HIGH) print("Air Pump Off") GPIO.cleanup()
#sudo pip3 install Adafruit_DHT #cd Adafruit_Python_DHT #sudo python3 setup.py install import Adafruit_DHT from AllPin import Pin sensor = Adafruit_DHT.DHT22 pin_num = Pin() pin=pin_num("pine") # Try to grab a sensor reading. Use the read_retry method which will retry up # to 15 times to get a sensor reading (waiting 2 seconds between each retry). humidity, temperature = Adafruit_DHT.read_retry(sensor, pin) def temp: return temperature def humidity: return humidity if humidity is not None and temperature is not None: print('Temp={0:0.1f}*C Humidity={1:0.1f}%'.format(temperature, humidity)) else: print('Failed to get reading. Try again!')