WelcomeScreen/examples/complete.py

22 lines
1.3 KiB
Python

from WelcomeScreen import WelcomeScreen
from machine import I2C, Pin # micropython's built-in library
from PCF8574T import I2C_LCD # https://git.privacynerd.de/BlueFox/micropython-libraries/src/branch/main/PCF8574T
BTN = Pin(14, Pin.IN, Pin.PULL_DOWN) # a interrupt btn
SWITCH = Pin(15, Pin.IN, Pin.PULL_DOWN) # another interrupt pin (switches also work -> it listens to changes, not high/low!)
LCD_SDA = Pin(8) # just some standard I2C serial data (SDA) outputs (on I2C channel 0 on Pi Pico)
LCD_SCL = Pin(9) # just some standard I2C serial clock (SCL) outputs (on I2C channel 0 on Pi Pico)
LCD_I2C_ADDR = 0x27 # the i2c adress of the display (yours might be different to this one)
LCD_I2C_NUM_ROWS = 2 # how many rows for character display has the display?
LCD_I2C_NUM_COLS = 16 # and how many characters can it display per row?
LCD = I2C_LCD(I2C(0, sda=LCD_SDA, scl=LCD_SCL, freq=400000),
LCD_I2C_ADDR,
LCD_I2C_NUM_ROWS,
LCD_I2C_NUM_COLS)
ws = WelcomeScreen(LCD, interrupt_pins=[BTN, SWITCH], subtitle="Custom name", starting_msg="Custom etc...", started_msg="Woo-hoo!")
ws.show(cycles=2, wait_after_cycles=2, fade_down={"enabled":True, "wait_between":0.5, "wait_after":0.2}, interruptable=True)
LCD.putstr("Now your program")