import time
from machine import I2C,SoftI2C,Pin,RTC
from pico_i2c_lcd import I2cLcd
i2c=SoftI2C(sda=Pin(0),scl=Pin(1),freq=400000)
lcd_addr=i2c.scan()[0]
print(lcd_addr)
lcd=I2cLcd(i2c,lcd_addr,2,16)
# lcd.clear()
# lcd.move_to(0,0)
# lcd.clear()
# lcd.move_to(3,1)
# lcd.putstr("Heya Kingshuk")
lcd.clear()
lcd.move_to(3,1)
# for i in range(1,10,1):
# lcd.clear()
# lcd.move_to(3,1)
# ans = 2*i
# lcd.putstr(ans)
# time.sleep(1)
rtc=RTC()
rtc.datetime((2024,2,2,6,11,48,00,00))
# while True:
# lcd.move_to(3,1)
# lcd.putstr(str(rtc.datetime()[2])+"/"+str(rtc.datetime()[1])+"/"+str(rtc.datetime()[0]))
while True:
lcd.putstr(str(rtc.datetime()[4])+":"+str(rtc.datetime()[5])+":"+str(rtc.datetime()[6]))
lcd.move_to(3,1)
lcd.putstr("0"+str(rtc.datetime()[2])+"-"+"0"+str(rtc.datetime()[1])+"-"+str(rtc.datetime()[0]))
time.sleep(1)
lcd.clear()