]>
vault307.fbx.one Git - RPI-PICO-I2C-LCD.git/blob - pico_i2c_lcd_test.py
4 from machine
import I2C
5 from lcd_api
import LcdApi
6 from pico_i2c_lcd
import I2cLcd
13 #Test function for verifying basic functionality
14 print("Running test_main")
15 i2c
= I2C(0, sda
=machine
.Pin(0), scl
=machine
.Pin(1), freq
=400000)
16 lcd
= I2cLcd(i2c
, I2C_ADDR
, I2C_NUM_ROWS
, I2C_NUM_COLS
)
17 lcd
.putstr("It Works!")
23 time
= utime
.localtime()
24 lcd
.putstr("{year:>04d}/{month:>02d}/{day:>02d} {HH:>02d}:{MM:>02d}:{SS:>02d}".format(
25 year
=time
[0], month
=time
[1], day
=time
[2],
26 HH
=time
[3], MM
=time
[4], SS
=time
[5]))
28 print("Turning cursor on")
31 print("Turning cursor off")
34 print("Turning blink cursor on")
37 print("Turning blink cursor off")
38 lcd
.blink_cursor_off()
40 print("Turning backlight off")
43 print("Turning backlight on")
46 print("Turning display off")
49 print("Turning display on")
52 print("Filling display")
55 for x
in range(32, 32+I2C_NUM_ROWS
*I2C_NUM_COLS
):
61 #if __name__ == "__main__":