Compare commits
4 Commits
Author | SHA1 | Date | |
---|---|---|---|
1b4d5fc0f3 | |||
40ddb2b7f2 | |||
14bfd886ad | |||
adb6232afc |
@ -16,6 +16,10 @@ Required Hardware:
|
||||
- 16x2 LCD with PCF8574\* backpack
|
||||
- [In standard configuration: 2 Hardware Buttons]
|
||||
|
||||
Measured power consumption (Raspberry Pi Pico W, LCM1602 LCD panel, PCF8574T backpack, generic button):
|
||||
- *~40mA* in idle mode, **+** *~2mA* when handling button events
|
||||
- *~43mA* at startup
|
||||
|
||||
|
||||
## 3. Hardware preparation & Software installation
|
||||
|
||||
@ -44,7 +48,7 @@ A pinout sheet can be found [here](Pinout_-_Pico-W.png).
|
||||
### 3.2 Software installation
|
||||
|
||||
1. To get your Raspberry Pi Pico W ready for micronEC, make sure you've already installed [microPython](https://micropython.org/) on it.
|
||||
2. Pull this repository to your local filesystem.
|
||||
2. Clone this repository to your local filesystem.
|
||||
3. Open [Thonny](https://thonny.org/)
|
||||
4. Open the following files:
|
||||
- [counter.py](counter.py) - library providing counting stuff
|
||||
@ -61,6 +65,7 @@ A pinout sheet can be found [here](Pinout_-_Pico-W.png).
|
||||
- WARNING: the pico always runs the main.py file on startup, so there's no chance to connect to it via USB. If you do so, and want to change things later, you have to completely reinstall [microPython](https://micropython.org/) on your Pico and all previously uploaded files will be gone. ONLY DO THAT IF YOU KNOW WHAT YOU ARE DOING.
|
||||
9. Have fun!
|
||||
|
||||
|
||||
## 4. License
|
||||
|
||||
micronEC is licensed under GPLv3, a copy of it can be found in [LICENSE.md](LICENSE.md).
|
||||
|
@ -1,3 +1,7 @@
|
||||
# https://github.com/T-622/RPI-PICO-I2C-LCD
|
||||
# Original driver by Tyler Peppy, modified by Benjamin Burkhardt (2024)
|
||||
|
||||
|
||||
"""
|
||||
MIT License
|
||||
|
||||
|
35
micronec.py
35
micronec.py
@ -32,18 +32,27 @@ COUNTER_NUMBER = 2 # how many counters do you want?
|
||||
COUNTER_NAMES = ["Counter 1", "Counter 2"] # names of the counters (MUST contain names for all counters)
|
||||
COUNTER_PINS = {0:2,1:3} # which pins to listen on (form {<COUNTER NUMBER STARTING FROM 0>:<GPIO PIN>}) (there MAY be doubles, you MAY not give pins for all counters)
|
||||
|
||||
# initialize the lcd display with GPIO pins 0 and 1 for data on i2c channel 0
|
||||
_i2c = I2C(0, sda=Pin(0), scl=Pin(1), freq=400000)
|
||||
lcd = I2C_LCD(_i2c, I2C_ADDR, I2C_NUM_ROWS, I2C_NUM_COLS)
|
||||
# initialize the counter array (class managing all the counters)
|
||||
counterArray = CounterArray(COUNTER_NUMBER, COUNTER_NAMES)
|
||||
# initialize the welcome screen
|
||||
ws = WelcomeScreen(lcd)
|
||||
# initialize the counter screen (display counter values on lcd)
|
||||
cs = CounterScreen(lcd, counterArray)
|
||||
|
||||
# Real program
|
||||
ws.show_welcome(WELCOME_CYCLES) # show welcome/startup message
|
||||
cs.show_screen() # DON'T REMOVE; show counter screen one time, may take up to 15s
|
||||
counterArray.register_listener(COUNTER_PINS, cs.show_screen) # register the listeners on the given pins
|
||||
# RUN micronec if it is the main program (not imported)
|
||||
|
||||
def run(): # for possible ProgramChooser use
|
||||
# initialize the lcd display with GPIO pins 0 and 1 for data on i2c channel 0
|
||||
_i2c = I2C(0, sda=Pin(0), scl=Pin(1), freq=400000)
|
||||
lcd = I2C_LCD(_i2c, I2C_ADDR, I2C_NUM_ROWS, I2C_NUM_COLS)
|
||||
# initialize the counter array (class managing all the counters)
|
||||
counterArray = CounterArray(COUNTER_NUMBER, COUNTER_NAMES)
|
||||
# initialize the welcome screen
|
||||
ws = WelcomeScreen(lcd)
|
||||
# initialize the counter screen (display counter values on lcd)
|
||||
cs = CounterScreen(lcd, counterArray)
|
||||
|
||||
# Real program
|
||||
ws.show_welcome(WELCOME_CYCLES) # show welcome/startup message
|
||||
cs.show_screen() # DON'T REMOVE; show counter screen one time, may take up to 15s
|
||||
counterArray.register_listener(COUNTER_PINS, cs.show_screen) # register the listeners on the given pins
|
||||
|
||||
while True:
|
||||
pass
|
||||
|
||||
if __name__ == "__main__":
|
||||
run()
|
||||
|
Loading…
x
Reference in New Issue
Block a user