]>
vault307.fbx.one Git - RPI-PICO-I2C-LCD.git/blob - pico_i2c_lcd_test.py
db05b81ef3af076b4f3905813e8a5a6ff7615ec0
3 from machine
import I2C
4 from lcd_api
import LcdApi
5 from pico_i2c_lcd
import I2cLcd
12 #Test function for verifying basic functionality
13 print("Running test_main")
14 i2c
= I2C(0, sda
=machine
.Pin(0), scl
=machine
.Pin(1), freq
=400000)
15 lcd
= I2cLcd(i2c
, I2C_ADDR
, I2C_NUM_ROWS
, I2C_NUM_COLS
)
16 lcd
.putstr("It Works!")
22 time
= utime
.localtime()
23 lcd
.putstr("{year}/{month}/{day} {HH}:{MM}:{SS}".format(
24 year
=str(time
[0]), month
=str(time
[1]), day
=str(time
[2]),
25 HH
=str(time
[3]), MM
=str(time
[4]), SS
=str(time
[5])))
27 print("Turning cursor on")
30 print("Turning cursor off")
33 print("Turning blink cursor on")
36 print("Turning blink cursor off")
37 lcd
.blink_cursor_off()
39 print("Turning backlight off")
42 print("Turning backlight on")
45 print("Turning display off")
48 print("Turning display on")
51 print("Filling display")
54 for x
in range(32, 32+I2C_NUM_ROWS
*I2C_NUM_COLS
):
60 #if __name__ == "__main__":