1- # MicroPython package template
1+ # MicroPython I2C LCD
22
3- [ ![ Downloads] ( https://pepy.tech/badge/micropython-package-template )] ( https://pepy.tech/project/micropython-package-template )
4- ![ Release] ( https://img.shields.io/github/v/release/brainelectronics/micropython-package-template ?include_prereleases&color=success )
3+ [ ![ Downloads] ( https://pepy.tech/badge/micropython-i2c-lcd )] ( https://pepy.tech/project/micropython-i2c-lcd )
4+ ![ Release] ( https://img.shields.io/github/v/release/brainelectronics/micropython-i2c-lcd ?include_prereleases&color=success )
55![ MicroPython] ( https://img.shields.io/badge/micropython-Ok-green.svg )
66[ ![ License: MIT] ( https://img.shields.io/badge/License-MIT-yellow.svg )] ( https://opensource.org/licenses/MIT )
7- [ ![ codecov] ( https://codecov.io/github/brainelectronics/micropython-package-template /branch/main/graph/badge.svg )] ( https://app.codecov.io/github/brainelectronics/micropython-package-template )
8- [ ![ CI] ( https://github.com/brainelectronics/micropython-package-template /actions/workflows/release.yml/badge.svg )] ( https://github.com/brainelectronics/micropython-package-template /actions/workflows/release.yml )
7+ [ ![ codecov] ( https://codecov.io/github/brainelectronics/micropython-i2c-lcd /branch/main/graph/badge.svg )] ( https://app.codecov.io/github/brainelectronics/micropython-i2c-lcd )
8+ [ ![ CI] ( https://github.com/brainelectronics/micropython-i2c-lcd /actions/workflows/release.yml/badge.svg )] ( https://github.com/brainelectronics/micropython-i2c-lcd /actions/workflows/release.yml )
99
10- MicroPython PyPi package template project with auto deploy
10+ Micropython package to control HD44780 LCD displays 1602 and 2004 via I2C
1111
1212---------------
1313
1414## General
1515
16- MicroPython PyPi package template with GitHub Action based testing and deploy
16+ Micropython package to control HD44780 LCD displays 1602 and 2004 via I2C
17+
18+ 📚 The latest documentation is available at
19+ [ MicroPython I2C LCD ReadTheDocs] [ ref-rtd-micropython-i2c-lcd ] 📚
1720
1821<!-- MarkdownTOC -->
1922
@@ -27,12 +30,6 @@ MicroPython PyPi package template with GitHub Action based testing and deploy
2730 - [Manually](#manually)
2831 - [Upload files to board](#upload-files-to-board)
2932- [ Usage] ( #usage )
30- - [ Create a PyPi \( micropython\) package] ( #create-a-pypi-micropython-package )
31- - [Setup](#setup-1)
32- - [Create a distribution](#create-a-distribution)
33- - [Upload to PyPi](#upload-to-pypi)
34- - [ Contributing] ( #contributing )
35- - [Unittests](#unittests)
3633- [ Credits] ( #credits )
3734
3835<!-- /MarkdownTOC -->
@@ -78,7 +75,7 @@ Install the latest package version of this lib on the MicroPython device
7875
7976``` python
8077import upip
81- upip.install(' micropython-package-template ' )
78+ upip.install(' micropython-i2c-lcd ' )
8279```
8380
8481#### Specific version
@@ -87,7 +84,7 @@ Install a specific, fixed package version of this lib on the MicroPython device
8784
8885``` python
8986import upip
90- upip.install(' micropython-package-template ==0.1.1 ' )
87+ upip.install(' micropython-i2c-lcd ==0.1.0 ' )
9188```
9289
9390#### Test version
@@ -101,12 +98,9 @@ will be used.
10198import upip
10299# overwrite index_urls to only take artifacts from test.pypi.org
103100upip.index_urls = [' https://test.pypi.org/pypi' ]
104- upip.install(' micropython-package-template ==0.2 .0rc1.dev6 ' )
101+ upip.install(' micropython-i2c-lcd ==0.1 .0rc1.dev2 ' )
105102```
106103
107- See also [ brainelectronics Test PyPi Server in Docker] [ ref-brainelectronics-test-pypiserver ]
108- for a test PyPi server running on Docker.
109-
110104### Manually
111105
112106#### Upload files to board
@@ -126,9 +120,9 @@ folders to the device
126120
127121``` bash
128122mkdir /pyboard/lib
129- mkdir /pyboard/lib/be_upy_blink
123+ mkdir /pyboard/lib/lcd_i2c
130124
131- cp be_upy_blink /* /pyboard/lib/be_upy_blink
125+ cp lcd_i2c /* /pyboard/lib/lcd_i2c
132126
133127cp examples/main.py /pyboard
134128cp examples/boot.py /pyboard
@@ -137,93 +131,32 @@ cp examples/boot.py /pyboard
137131## Usage
138132
139133``` python
140- from be_upy_blink import flash_led
141- from machine import Pin
142-
143- led_pin = Pin(4 , Pin.OUT )
144-
145- flash_led(pin = led_pin, amount = 3 )
146- # flash_led(pin=led_pin, amount=3, on_time=1, off_time=3)
147- ```
148-
149- ## Create a PyPi (micropython) package
150-
151- ### Setup
152-
153- Install the required python package with the following command in a virtual
154- environment to avoid any conflicts with other packages installed on your local
155- system.
156-
157- ``` bash
158- python3 -m venv .venv
159- source .venv/bin/activate
160-
161- pip install twine
162- ```
163-
164- ### Create a distribution
165-
166- This module overrides distutils (also compatible with setuptools) ` sdist `
167- command to perform pre- and post-processing as required for MicroPython's
168- upip package manager. This script is taken from
169- [ pfalcon's picoweb] [ ref-pfalcon-picoweb-sdist-upip ] and updated to be PEP8
170- conform.
171-
172- ``` bash
173- python setup.py sdist
174- ```
175-
176- A new folder ` dist ` will be created. The [ ` sdist_upip ` ] ( sdist_upip.py ) will be
177- used to create everything necessary.
178-
179- ### Upload to PyPi
180-
181- ** Be aware: [ pypi.org] [ ref-pypi ] and [ test.pypi.org] [ ref-test-pypi ] are different**
134+ from lcd_i2c import LCD
135+ from machine import I2C , Pin
182136
183- You can ** NOT** login to [ test.pypi.org] [ ref-test-pypi ] with the
184- [ pypi.org] [ ref-pypi ] account unless you created the same on the other. See
185- [ invalid auth help page of ** test** pypi] [ ref-invalid-auth-test-pypi ]
186-
187- For testing purposes add ` --repository testpypi ` to
188- upload it to [ test.pypi.org] [ ref-test-pypi ]
189-
190- ``` bash
191- twine upload dist/micropython-package-template-* .tar.gz -u PYPI_USERNAME -p PYPI_PASSWORD
192- ```
137+ I2C_ADDR = 0x 27
138+ NUM_ROWS = 2
139+ NUM_COLS = 16
193140
194- ## Contributing
141+ # define custom I2C interface, default is 'I2C(0)'
142+ # check the docs of your device for further details and pin infos
143+ i2c = I2C(1 , scl = Pin(3 ), sda = Pin(2 ), freq = 800_000 )
144+ lcd = LCD(addr = I2C_ADDR , cols = NUM_COLS , rows = NUM_ROWS , i2c = i2c)
195145
196- ### Unittests
197-
198- Run the unittests locally with the following command after installing this
199- package in a virtual environment
200-
201- ``` bash
202- # run all tests
203- nose2 --config tests/unittest.cfg
204-
205- # run only one specific tests
206- nose2 tests.test_blink.TestBlink.test_flash_led
207- ```
208-
209- Generate the coverage files with
210-
211- ``` bash
212- python create_report_dirs.py
213- coverage html
146+ lcd.begin()
147+ lcd.print(" Hello World" )
214148```
215149
216- The coverage report is placed at ` reports/coverage/html/index.html `
150+ For further examples check the ` examples ` folder or the Example chapter in the
151+ docs.
217152
218153## Credits
219154
220- Based on the [ PyPa sample project ] [ ref-pypa-sample ] .
155+ Based on [ Frank de Brabanders Arduino LiquidCrystal I2C Library ] [ ref-arduino-lcd-i2c-library ] .
221156
222157<!-- Links -->
158+ [ ref-rtd-micropython-i2c-lcd ] : https://micropython-i2c-lcd.readthedocs.io/en/latest/
223159[ ref-remote-upy-shell ] : https://github.com/dhylands/rshell
224- [ ref-brainelectronics-test-pypiserver ] : https://github.com/brainelectronics/test-pypiserver
225- [ ref-pypa-sample ] : https://github.com/pypa/sampleproject
226- [ ref-pfalcon-picoweb-sdist-upip ] : https://github.com/pfalcon/picoweb/blob/b74428ebdde97ed1795338c13a3bdf05d71366a0/sdist_upip.py
160+ [ ref-arduino-lcd-i2c-library ] : https://github.com/fdebrabander/Arduino-LiquidCrystal-I2C-library
227161[ ref-test-pypi ] : https://test.pypi.org/
228162[ ref-pypi ] : https://pypi.org/
229- [ ref-invalid-auth-test-pypi ] : https://test.pypi.org/help/#invalid-auth
0 commit comments