40 lines
1.2 KiB
Python
40 lines
1.2 KiB
Python
from lcd_driver import I2C_LCD
|
|
from machine import I2C, Pin, Timer
|
|
import time
|
|
import machine
|
|
|
|
|
|
class WelcomeScreen:
|
|
def __init__(self):
|
|
self.I2C_ADDR = 0x27
|
|
self.I2C_NUM_ROWS = 2
|
|
self.I2C_NUM_COLS = 16
|
|
|
|
self._i2c = I2C(0, sda=Pin(0), scl=Pin(1), freq=400000)
|
|
self.lcd = I2C_LCD(self._i2c, self.I2C_ADDR, self.I2C_NUM_ROWS, self.I2C_NUM_COLS)
|
|
|
|
|
|
def show_welcome(self, loops=1): # loops says how often the Starting text goes through
|
|
if loops < 1: loops = 1
|
|
padding = " " # 16 spaces
|
|
started_str = " Started! "
|
|
|
|
for i in range(loops):
|
|
line1 = padding + "Starting..." + padding
|
|
line2 = " micronEC "
|
|
for i in range(32):
|
|
self.lcd.putstr(line1[0:16])
|
|
self.lcd.move_to(0,1)
|
|
self.lcd.putstr(line2[0:16])
|
|
line1 = line1[1:]
|
|
|
|
self.lcd.move_to(0,0)
|
|
self.lcd.putstr(started_str)
|
|
|
|
# now fade down
|
|
time.sleep(2)
|
|
self.lcd.move_to(0,0)
|
|
self.lcd.putstr(padding + started_str)
|
|
time.sleep(0.1)
|
|
self.lcd.clear()
|