diff --git a/init.py b/init.py index 4c47153..df2a3a1 100644 --- a/init.py +++ b/init.py @@ -4,6 +4,7 @@ from astral.sun import sun from datetime import date from grove.gpio import GPIO +from grove.display.jhd1802 import JHD1802 city = LocationInfo("Seinäjoki", "Finland", "Europe/Helsinki", 62.7900, 22.8400) s = sun(city.observer, date=date.today()) @@ -21,9 +22,12 @@ class AlarmClock: ledGpio: GPIO buttonGpio: GPIO lastKnownButtonState: bool = False + lcd: JHD1802 def __init__(self, pins: dict = {}): self.ledGpio = GPIO(pins.get("led", 5), GPIO.OUT) self.buttonGpio = GPIO(pins.get("button", 6), GPIO.IN) + self.lcd = JHD1802() + self.setLcdText("AlarmClock Init") def start(self): @@ -43,6 +47,8 @@ class AlarmClock: print(f"Button {button} pressed") def setLcdText(self, text: str): + self.lcd.clear() + self.lcd.write(text) print(f"LCD: {text}")