import time
from machine import I2C, SoftI2C, Pin, RTC
from pico_i2c_lcd import I2cLcd
i2c = SoftI2C(sda=Pin(20),scl=Pin(19),freq=40000)
lcd_addr = i2c.scan()[0]
print(lcd_addr)
lcd = I2cLcd(i2c,lcd_addr,2,16)
rtc = RTC()
rtc.datetime((2024,2,16,5,3,23,0,0))
while True:
tm = rtc.datetime()
ss = tm[6]
if ss < 10:
ss = '0'+str(ss)
lcd.clear()
lcd.move_to(4,1)
lcd.putstr("{0}:{1}:{2}".format(tm[4],tm[5],ss))
time.sleep(1)