X-Git-Url: https://vault307.fbx.one/gitweb/RPI-PICO-I2C-LCD.git/blobdiff_plain/ee137bccf105fe8d3e71bbdbaae0e04f1c482476..96bbc9fbf500b10f92a802f9698f2e4ac923f428:/pico_i2c_lcd_test.py?ds=sidebyside diff --git a/pico_i2c_lcd_test.py b/pico_i2c_lcd_test.py index db05b81..34fd9ff 100644 --- a/pico_i2c_lcd_test.py +++ b/pico_i2c_lcd_test.py @@ -1,5 +1,6 @@ import utime +import machine from machine import I2C from lcd_api import LcdApi from pico_i2c_lcd import I2cLcd @@ -20,9 +21,9 @@ def test_main(): while True: lcd.clear() time = utime.localtime() - lcd.putstr("{year}/{month}/{day} {HH}:{MM}:{SS}".format( - year=str(time[0]), month=str(time[1]), day=str(time[2]), - HH=str(time[3]), MM=str(time[4]), SS=str(time[5]))) + lcd.putstr("{year:>04d}/{month:>02d}/{day:>02d} {HH:>02d}:{MM:>02d}:{SS:>02d}".format( + year=time[0], month=time[1], day=time[2], + HH=time[3], MM=time[4], SS=time[5])) if count % 10 == 0: print("Turning cursor on") lcd.show_cursor() @@ -58,4 +59,4 @@ def test_main(): utime.sleep(2) #if __name__ == "__main__": -test_main() \ No newline at end of file +test_main()