Signed-off-by: Ebbe Baß <ebbe@ping-mee.de>
master
Ebbe Baß 2022-07-17 17:26:16 +02:00
parent 64f9a7666a
commit e66dfa63de
1 changed files with 31 additions and 31 deletions

62
test.py
View File

@ -4,39 +4,39 @@ from datetime import datetime
import RPi.GPIO as GPIO import RPi.GPIO as GPIO
GPIO.setmode(GPIO.BCM) # GPIO.setmode(GPIO.BCM)
GPIO.setup(19, GPIO.OUT) # GPIO.setup(19, GPIO.OUT)
GPIO.output(19, GPIO.HIGH) # GPIO.output(19, GPIO.HIGH)
time.sleep(1) # time.sleep(1)
GPIO.output(19, GPIO.LOW) # GPIO.output(19, GPIO.LOW)
time.sleep(5) # time.sleep(5)
GPIO.cleanup() # GPIO.cleanup()
# def debug_print(message: str): def debug_print(message: str):
# now = datetime.now() now = datetime.now()
# current_time = now.strftime("%H:%M:%S") current_time = now.strftime("%H:%M:%S")
# print('[DEBUG]['+current_time+'] '+message) print('[DEBUG]['+current_time+'] '+message)
# def error_print(message: str): def error_print(message: str):
# now = datetime.now() now = datetime.now()
# current_time = now.strftime("%H:%M:%S") current_time = now.strftime("%H:%M:%S")
# print('[ERROR]['+current_time+'] '+message) print('[ERROR]['+current_time+'] '+message)
# def relay_controller(pin: int, state: str): def relay_controller(pin: int, state: str):
# 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()
# 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)
# relay.off() relay.off()
# debug_print("Set relay-pin "+str(pin)+" to state False") debug_print("Set relay-pin "+str(pin)+" to state False")
# else: else:
# error_print("Unknown state for relay ("+state+")") error_print("Unknown state for relay ("+state+")")
# while True: while True:
# relay_controller(4, "True") relay_controller(19, "True")
# time.sleep(2) time.sleep(2)
# relay_controller(4, "False") relay_controller(19, "False")
# time.sleep(2) time.sleep(2)