From c3276e6f78a97edd09a64a50b6f1b48189961338 Mon Sep 17 00:00:00 2001 From: Aaro Varis Date: Thu, 15 Jan 2026 10:35:43 +0200 Subject: [PATCH] a --- init.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/init.py b/init.py index df2a3a1..73d8635 100644 --- a/init.py +++ b/init.py @@ -23,6 +23,7 @@ class AlarmClock: buttonGpio: GPIO lastKnownButtonState: bool = False lcd: JHD1802 + lastButtonPressTime: float = 0.0 def __init__(self, pins: dict = {}): self.ledGpio = GPIO(pins.get("led", 5), GPIO.OUT) self.buttonGpio = GPIO(pins.get("button", 6), GPIO.IN) @@ -45,6 +46,9 @@ class AlarmClock: def onButtonPress(self, button: str): print(f"Button {button} pressed") + if button == "button": + self.lastButtonPressTime = time() + self.setLcdText(self.lastButtonPressTime.__str__()) def setLcdText(self, text: str): self.lcd.clear()