Package: micropython-i2c-lcd
MicroPython I2C LCDMicroPython package to control HD44780 LCD displays 1602 and 2004 via I2CGeneralMicroPython package to control HD44780 LCD displays 1602 and 2004 via I2C📚 The latest documentation is available atMicroPython I2C LCD ReadTheDocs📚InstallationInstall required toolsSetupInstall package with upipGeneralSpecific versionTest versionManuallyUpload files to boardUsageCreditsInstallationInstall required toolsPython3 must be installed on your system. Check the current Python version
with the following commandpython--version
python3--versionDepending on which commandPython 3.x.y(with x.y as some numbers) is
returned, use that command to proceed.python3-mvenv.venvsource.venv/bin/activate

pipinstall-rrequirements.txtSetupInstall package with upipConnect the MicroPython device to a network (if possible)importnetworkstation=network.WLAN(network.STA_IF)station.active(True)station.connect('SSID','PASSWORD')station.isconnected()GeneralInstall the latest package version of this lib on the MicroPython deviceimportmipmip.install("github:brainelectronics/micropython-i2c-lcd")For MicroPython versions below 1.19.1 use theupippackage instead ofmipimportupipupip.install('micropython-i2c-lcd')Specific versionInstall a specific, fixed package version of this lib on the MicroPython deviceimportmip# install a verions of a specific branchmip.install("github:brainelectronics/micropython-i2c-lcd",version="feature/initial-implementation")# install a tag versionmip.install("github:brainelectronics/micropython-i2c-lcd",version="0.1.0")For MicroPython versions below 1.19.1 use theupippackage instead ofmipimportupipupip.install('micropython-i2c-lcd==0.1.0')Test versionInstall a specific release candidate version uploaded toTest Python Package Indexon every PR on the
MicroPython device. If no specific version is set, the latest stable version
will be used.importmipmip.install("github:brainelectronics/micropython-i2c-lcd",version="0.1.0-rc3.dev1")For MicroPython versions below 1.19.1 use theupippackage instead ofmipimportupip# overwrite index_urls to only take artifacts from test.pypi.orgupip.index_urls=['https://test.pypi.org/pypi']upip.install('micropython-i2c-lcd==0.1.0rc3.dev1')ManuallyUpload files to boardCopy the module to the MicroPython board and import them as shown below
usingRemote MicroPython shellOpen the remote shell with the following command. Additionally use-b 115200in case no CP210x is used but a CH34x.rshell--port/dev/tty.SLAB_USBtoUART--editornanoPerform the following command inside thershellto copy all files and
folders to the devicemkdir/pyboard/lib
mkdir/pyboard/lib/lcd_i2c

cplcd_i2c/*/pyboard/lib/lcd_i2c

cpexamples/main.py/pyboard
cpexamples/boot.py/pyboardUsagefromlcd_i2cimportLCDfrommachineimportI2C,Pin# PCF8574 on 0x50I2C_ADDR=0x27# DEC 39, HEX 0x27NUM_ROWS=2NUM_COLS=16# define custom I2C interface, default is 'I2C(0)'# check the docs of your device for further details and pin infosi2c=I2C(0,scl=Pin(13),sda=Pin(12),freq=800000)lcd=LCD(addr=I2C_ADDR,cols=NUM_COLS,rows=NUM_ROWS,i2c=i2c)lcd.begin()lcd.print("Hello World")For further examples check theexamplesfolder or the Example chapter in the
docs.CreditsBased onFrank de Brabanders Arduino LiquidCrystal I2C Library.