parent
a49ed2086f
commit
2c1c294bab
3
main.py
3
main.py
|
@ -25,15 +25,12 @@ def error_print(message: str):
|
||||||
|
|
||||||
#relay
|
#relay
|
||||||
def relay_controller(pin: int, state: str):
|
def relay_controller(pin: int, state: str):
|
||||||
GPIO.cleanup()
|
|
||||||
GPIO.setmode(GPIO.BCM)
|
GPIO.setmode(GPIO.BCM)
|
||||||
GPIO.setup(pin, GPIO.OUT)
|
GPIO.setup(pin, GPIO.OUT)
|
||||||
if state == "True":
|
if state == "True":
|
||||||
# relay = gpiozero.OutputDevice(pin, active_high=False, initial_value=False)
|
# relay = gpiozero.OutputDevice(pin, active_high=False, initial_value=False)
|
||||||
# relay.on()
|
# relay.on()
|
||||||
GPIO.output(pin, GPIO.LOW)
|
GPIO.output(pin, GPIO.LOW)
|
||||||
time.sleep(1)
|
|
||||||
GPIO.output(pin, GPIO.HIGH)
|
|
||||||
debug_print("Set relay-pin "+str(pin)+" to state True")
|
debug_print("Set relay-pin "+str(pin)+" to state True")
|
||||||
elif state == "False":
|
elif state == "False":
|
||||||
# relay = gpiozero.OutputDevice(pin, active_high=False, initial_value=False)
|
# relay = gpiozero.OutputDevice(pin, active_high=False, initial_value=False)
|
||||||
|
|
Loading…
Reference in New Issue