micronEC/micronec.py

23 lines
574 B
Python
Raw Normal View History

from lcd_driver import I2C_LCD
from machine import I2C, Pin
from welcome import WelcomeScreen
from counter import CounterArray
from lcd_screen import CounterScreen
import time
I2C_ADDR = 0x27
I2C_NUM_ROWS = 2
I2C_NUM_COLS = 16
_i2c = I2C(0, sda=Pin(0), scl=Pin(1), freq=400000)
lcd = I2C_LCD(_i2c, I2C_ADDR, I2C_NUM_ROWS, I2C_NUM_COLS)
counterArray = CounterArray(2, ["Counter 1", "Counter 2"])
ws = WelcomeScreen(lcd)
cs = CounterScreen(lcd, counterArray)
# Real program
ws.show_welcome(1)
cs.show_screen()
counterArray.register_listener({0:2,1:3}, cs.show_screen)