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()