Made things ready for production v1.0 by adding constants to micronec.py for a simpler configuration.
This commit is contained in:
parent
0d71693aac
commit
1b3c68ddb3
13
micronec.py
13
micronec.py
@ -3,20 +3,25 @@ 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
|
||||
WELCOME_CYCLES = 1
|
||||
COUNTER_NUMBER = 2
|
||||
COUNTER_NAMES = ["Counter 1", "Counter 2"]
|
||||
COUNTER_PINS = {0:2,1:3}
|
||||
|
||||
|
||||
_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"])
|
||||
counterArray = CounterArray(COUNTER_NUMBER, COUNTER_NAMES)
|
||||
ws = WelcomeScreen(lcd)
|
||||
cs = CounterScreen(lcd, counterArray)
|
||||
|
||||
# Real program
|
||||
ws.show_welcome(1)
|
||||
ws.show_welcome(WELCOME_CYCLES)
|
||||
cs.show_screen()
|
||||
counterArray.register_listener({0:2,1:3}, cs.show_screen)
|
||||
counterArray.register_listener(COUNTER_PINS, cs.show_screen)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user