Esempio n. 1
0
def fill_small_basin():  #run the filling and nutrient dispersal process
    global air
    global fill_pump
    OUT.OFF(air)  #turn air pump off
    OUT.ON(fill_pump)
    time.sleep(5)
    Float.pumpOff()
    time.sleep(2)
    Valve.nute()
    OUT.ON(air)  #turn air pump on
Esempio n. 2
0
import OUT
import time
OUT.toggle(3)
time.sleep(10)
OUT.toggle(3)
Esempio n. 3
0
import OUT
import time
import Float
import Valve
import ADC
time.sleep(2)
f = open("/var/www/html/hygrometer_readings.txt","w") #create file to write to change!!!
temp = ADC.readadc(0) #read hygrometer value
percent = 100.0 - (temp / 10.23)
#print(str(percent))
f.write("First reading: " + str(percent) + '\n') #write first to file
#f.write("First reading: 43.3456542345" + "\n")
f.close()
OUT.ON(6) #turn on the lights
time.sleep(3) #wait 3 seconds
OUT.ON(3) #start filling bucket
time.sleep(10)#wait 10 seconds
Float.pumpOff() #waits for switch to turn off pump
time.sleep(3) #wait 3 seconds
Valve.nute() #dispenses nutrients
OUT.ON(5) #turn on air pump
time.sleep(2)
OUT.ON(4) #turn on hyrdroponic pump
time.sleep(30)
OUT.OFF(4) #turn off hydroponic pump
#OUT.ON(2)
time.sleep(10)
OUT.OFF(6) #turn off the lights
time.sleep(1)
OUT.OFF(5) #turn off air pump'''
Esempio n. 4
0
def pumpOff():
    GPIO.wait_for_edge(40, GPIO.RISING)
    OUT.OFF(3)
Esempio n. 5
0
def light_off():  #turns light off
    global light_outlet
    OUT.OFF(light_outlet)
Esempio n. 6
0
def light_on():  #turns light on
    global light_outlet
    OUT.ON(light_outlet)
Esempio n. 7
0
def water():  #turns on water for specified watering interval then off again
    global water_pump
    global water_time
    OUT.ON(water_pump)
    time.sleep(water_time)
    OUT.OFF(water_pump)
Esempio n. 8
0
def run():  #checks for and runs functions that are scheduled to run
    while 1:
        schedule.run_pending()
        time.sleep(1)


def start_water():
    global timeBetweenWater
    water()
    schedule.every(timeBetweenWater).hours.do(water).tag(
        "water")  #water plants every 8 hours
    return schedule.CancelJob


OUT.ON(air)  #initiates air pump

#schedule the methods
#hygrometers twice a day
#temp and humidity once a day
#lights on and off at changing intervals
schedule.every().hour.do(record_ph).tag("record_ph")  #checks the ph every hour
schedule.every().hour.do(temp_humid_live).tag("temp_humid_live")
schedule.every().hour.do(hygro_live).tag("hygro_live")

schedule.every().day.at(timeLightsOn).do(light_on).tag(
    "light_on1")  #turns lights on
schedule.every().day.at(timeLightsOff).do(light_off).tag(
    "light_off1")  #turns lights off

schedule.every().day.at("12:00").do(check_temp_humid).tag(