This commit is contained in:
Aaro Varis
2026-01-15 10:44:07 +02:00
parent 8a22f873bd
commit fb134bc25a

View File

@@ -28,7 +28,7 @@ class AlarmClock:
def __init__(self, pins: dict = {}):
self.ledGpio = GPIO(pins.get("led", 5), GPIO.OUT)
self.buttonGpio = GPIO(pins.get("button", 6), GPIO.IN)
self.relayGpio = GPIO(pins.get("relay", 16), GPIO.OUT)
self.relayGpio = GPIO(pins.get("relay", 17), GPIO.OUT)
self.lcd = JHD1802()
self.setLcdText("AlarmClock Init")
@@ -49,6 +49,7 @@ class AlarmClock:
print(f"Button '{button}' pressed state: {state}")
if button == "button":
self.lastButtonPressTime = time()
self.relayGpio.write(GPIO.HIGH if state else GPIO.LOW)
self.setLcdText(self.lastButtonPressTime.__str__())
def setLcdText(self, text: str):