import time
from machine import I2C,SoftI2C,Pin,RTC
from pico_i2c_lcd import I2cLcd
i2c=SoftI2C(sda=Pin(26),scl=Pin(27),freq=400000)
lcd_address=i2c.scan()[0]
# print(lcd_address)
lcd=I2cLcd(i2c,lcd_address,2,16)
rtc=RTC()
rtc.datetime((2021,2,2,5,10,14,0,0))
time.sleep(1)
while(True):
h=(rtc.datetime())[4]
m=(rtc.datetime())[5]
s=(rtc.datetime())[6]
s1=""
s2=""
s3=""
if h<10:
s1="0"+str(h)
else:
s1=str(h)
if m<10:
s2="0"+str(m)
else:
s2=str(m)
if s<10:
s3="0"+str(s)
else:
s3=str(s)
lcd.putstr(s1+":"+s2+ ":"+s3)
time.sleep(1)
lcd.clear()