def toggle_pump(): if str116.get_relay(settings.relays['pump']): print 'Turning pump OFF . . . ', str116.set_relay(settings.relays['pump'], 0) else: print 'Turning pump ON . . . ', str116.set_relay(settings.relays['pump'], 1) print 'DONE'
def execute(request, args=""): args = parse_args(args) # there's a better way to do this... if request == "set_relay": str116.set_relay(int(args[0]), int(args[1])) if request == "set_sv": omega.set_setpoint(float(args[0])) if request == "set_pid_on": omega.run() if request == "set_pid_off": omega.stop()
def toggle_relay(relay_address): if isinstance(relay_address, int) and relay_address < 3: if str116.get_relay(relay_address): print 'Turning valve OFF . . . ', str116.set_relay(relay_address, 0) else: print 'Turning valve ON . . . ', str116.set_relay(relay_address, 1) print 'DONE' else: print 'INVALID RELAY ADDRESS'
def set_sparge_stage(): # set relay 1 (hlt) to ON, wait 10 seconds print 'Setting sparge valve ON ', str116.set_relay(settings.relays['hlt'], 1) import time for i in range(1,11): print ',', time.sleep(1) print ' DONE' # set relay 2 (rimsToMash) to OFF print 'Directing RIMS valve to boil tun . . . ', str116.set_relay(settings.relays['rimsToMash'], 0) print 'DONE' # ensure that PID is ON if instr.is_running() == False: print 'Turning PID ON . . . ', instr.run() print 'DONE'
#!/usr/bin/env python import str116 import time # first variable is the relay number in decimal (0-15) # second variable is off/on (0,1) in decimal n = 0 while n < 16: str116.set_relay(n, 0) n += 1 str116.set_relay(n, 1) # time.sleep(.25) str116.set_relay(15, 0)
import str116 import sys import settings str116.set_relay(int(sys.argv[1]), int(sys.argv[2])) if int(sys.argv[2]) == 1: state = "on" else: state = "off" print("relay " + sys.argv[1] + " " + state)
#!/usr/bin/env python import str116 import settings str116.set_relay(settings.relays['pump'], 1) print("pump on")
def set_pump_on(): print 'Turning pump ON . . . ', str116.set_relay(settings.relays['pump'], 1) print 'DONE'
def set_pump_off(): print 'Turning pump OFF . . . ', str116.set_relay(settings.relays['pump'], 0) print 'DONE'