Thomascountz / micropython_i2c_lcd

This MicroPython library provides a framework for interacting with HD44780-based LCD displays through a PCF8574 I/O expander. It offers a high-level API for LCD control, including text display, cursor manipulation, and backlight settings, while also providing lower-level access to the GPIO operations on the PCF8574.
MIT License
3 stars 3 forks source link

Publish to MIP #6

Open Thomascountz opened 6 months ago

Thomascountz commented 6 months ago

See: https://docs.micropython.org/en/latest/reference/packages.html

Also consider where else might be appropriate to publish/share.

CombatVolcano commented 3 months ago

What is the name of it on MIP?

CombatVolcano commented 3 months ago

For anyone having trouble, (I am using Pico W) make sure WLAN is connected and MIP install the packages, here is some code to help you get to hello world. I am using the backpack with basic 5v power and SCA > GP0, SCL > GP1 and it works for me. I am running it via VS Code using MicroPico

Thanks very much to the creator @Thomascountz

from machine import Pin
from utime import sleep
import network
from machine import Pin, I2C

wlan = network.WLAN(network.STA_IF)
wlan.active(True)
wlan.connect("YOUR_NETWORK","THE_PASSWORD")
print("WLAN", wlan.isconnected())
import mip

# LCD FILES - COMMENT OUT AFTER INSTALL
mip.install("github:Thomascountz/micropython_i2c_lcd/hd44780_4bit_driver.py")
mip.install("github:Thomascountz/micropython_i2c_lcd/hd44780_4bit_payload.py")
mip.install("github:Thomascountz/micropython_i2c_lcd/pcf8574.py")
mip.install("github:Thomascountz/micropython_i2c_lcd/hd44780.py")
mip.install("github:Thomascountz/micropython_i2c_lcd/lcd.py")
mip.install("github:Thomascountz/micropython_i2c_lcd/backlight_driver.py")

print("do LCD imports...")
from pcf8574 import PCF8574
from hd44780 import HD44780
from lcd import LCD
print("... LCD imports done")

i2c = I2C(0, sda=Pin(0), scl=Pin(1), freq=400000)
pcf8574 = PCF8574(i2c)
hd44780 = HD44780(pcf8574, num_lines=2, num_columns=16)
lcd = LCD(hd44780, pcf8574)
lcd.backlight_on()
lcd.write_lines("Hello, world!\n")