Metadata-Version: 2.4
Name: rpi_lcd_i2c_micropython
Version: 0.1.0
Summary: MicroPython driver for HD44780 character LCDs with PCF8574 I2C backpacks
Author: Samarth Joneja
License: MIT
Keywords: micropython,lcd,i2c,pcf8574,hd44780,raspberry-pi-pico
Classifier: Development Status :: 3 - Alpha
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: System :: Hardware
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Dynamic: license-file

# rpi_lcd_i2c_micropython

A small MicroPython driver for HD44780-compatible character LCDs connected through a common PCF8574 I2C backpack.

> This is a MicroPython library. Install it onto a MicroPython board's filesystem; installing it with desktop CPython pip on Linux does not make `machine` available.

## Usage

```python
from machine import I2C, Pin
from rpi_lcd_i2c_micropython import I2cLcd

i2c = I2C(0, sda=Pin(0), scl=Pin(1), freq=400000)
print([hex(addr) for addr in i2c.scan()])

lcd = I2cLcd(i2c, 0x27, 2, 16)  # address, rows, columns
lcd.putstr("Hello, world!")
lcd.move_to(0, 1)
lcd.putstr("MicroPython")
```

Change the I2C bus, pins, address, row count, and column count for your board and LCD. Common backpack addresses are `0x27` and `0x3F`; use `i2c.scan()` to check.

## Install on a board

Copy the `src/rpi_lcd_i2c_micropython/` package directory to the board's `/lib/rpi_lcd_i2c_micropython/` directory using Thonny or `mpremote`. The package on PyPI is the source distribution for developers and tools; MicroPython boards do not generally run desktop `pip` directly.

## Wiring caution

Use I2C signals that are safe for your board's logic voltage. Many LCD backpacks powered at 5 V pull SDA/SCL up to 5 V, which can damage 3.3 V boards. Use suitable level shifting or 3.3 V pull-ups.

## Compatibility

This driver assumes the common PCF8574 backpack pin mapping. Some backpacks use a different mapping. Test on your target board before relying on it in a project.
