From 5b1adee3ad35ef9b82f0c00d6b755ec4e67c6686 Mon Sep 17 00:00:00 2001 From: Adolfo Delorenzo Date: Fri, 5 Jul 2024 09:12:03 -0600 Subject: [PATCH] door.py updates --- door.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/door.py b/door.py index b1f5f3f..7732668 100644 --- a/door.py +++ b/door.py @@ -18,14 +18,16 @@ PIN_17 = 17 PIN_18 = 18 # Set GPIO -GPIO.setup(PIN_17, GPIO.IN) -GPIO.setup(PIN_18, GPIO.OUT) +result_17 = GPIO.setup(PIN_17, GPIO.IN) +result_18 - GPIO.setup(PIN_18, GPIO.OUT) while True: if GPIO.input(PIN_17) == GPIO.HIGH: print("Puerta abierta") + client.publish("iiot/"+ myhost +"/door", result_17) GPIO.output(PIN_18, GPIO.HIGH) # Luz Roja encendida else: - GPIO.output(PIN_18, GPIO.LOW) + GPIO.output(PIN_18, GPIO.LOW) + client.publish("iiot/"+ myhost +"/door", result_18)