{"id":13802182,"url":"https://github.com/Thomascountz/micropython_i2c_lcd","last_synced_at":"2025-05-13T12:32:30.168Z","repository":{"id":197501082,"uuid":"698769077","full_name":"Thomascountz/micropython_i2c_lcd","owner":"Thomascountz","description":"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.","archived":false,"fork":false,"pushed_at":"2024-06-21T13:04:01.000Z","size":36,"stargazers_count":3,"open_issues_count":2,"forks_count":3,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-11-18T17:51:24.871Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Thomascountz.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-09-30T22:58:23.000Z","updated_at":"2024-07-27T08:54:18.000Z","dependencies_parsed_at":"2024-06-22T05:40:57.896Z","dependency_job_id":"7ff8041c-ec7e-4ace-8a61-6cbd0305ecf2","html_url":"https://github.com/Thomascountz/micropython_i2c_lcd","commit_stats":{"total_commits":13,"total_committers":2,"mean_commits":6.5,"dds":0.07692307692307687,"last_synced_commit":"22503d1c6f7c30fe54a08d3ee694b9056f45a26b"},"previous_names":["thomascountz/micropython_i2c_lcd"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Thomascountz%2Fmicropython_i2c_lcd","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Thomascountz%2Fmicropython_i2c_lcd/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Thomascountz%2Fmicropython_i2c_lcd/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Thomascountz%2Fmicropython_i2c_lcd/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Thomascountz","download_url":"https://codeload.github.com/Thomascountz/micropython_i2c_lcd/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253942658,"owners_count":21988106,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-04T00:01:38.312Z","updated_at":"2025-05-13T12:32:29.902Z","avatar_url":"https://github.com/Thomascountz.png","language":"Python","funding_links":[],"categories":["Libraries"],"sub_categories":["Display"],"readme":"# HD44780 LCD Controller Interface with MicroPython\n\nhttps://github.com/Thomascountz/micropython_i2c_lcd/assets/19786848/07470ccc-1ee1-467d-855a-d67cb7de6779\n\nThis library provides an interface for controlling HD44780-based LCD displays using a PCF8574 I/O expander (often sold as a single module) with a MicroPython-compatible microcontroller. The library is designed to offer high-level functions for LCD control while allowing access to underlying GPIO operations on the PCF8574 when necessary.\n\n## Overview\n\nThe library is structured around several classes, each serving a specific role:\n\n1. `BacklightDriver`: An abstract base class for controlling the backlight of an LCD display.\n\n2. `HD44780`: A class for interacting with HD44780 LCD drivers through a PCF8574 I/O expander. Provides methods for writing characters and strings to the LCD, clearing the display, and controlling the display properties.\n\n3. `HD447804BitDriver`: An abstract base class for controlling the HD44780 LCD controller through a 4-bit data bus.\n\n4. `HD447804BitPayload`: A class representing data to be written to the HD44780 LCD controller.\n\n5. `LCD`: A high-level API for controlling HD44780-based LCD displays. This class provides methods to write text to the LCD, control the cursor and display properties, and clear the display.\n\n6. `PCF8574`: A class for controlling the HD44780 LCD controller through a PCF8574 I/O expander. Implements the HD447804BitController and BacklightDriver interfaces, providing methods for writing 4-bit payloads to the HD44780 LCD controller via the PCF8574, and controlling the LCD's backlight.\n\n7. `test_main`: Contains a function for testing the library's functionality.\n\n## Usage\n\nFirst, import the necessary classes from the library:\n\n```python\nfrom machine import Pin, I2C\nfrom pcf8574 import PCF8574\nfrom hd44780 import HD44780\nfrom lcd import LCD\n```\n\nThen, initialize the LCD:\n\n```python\ni2c = I2C(0, sda=Pin(0), scl=Pin(1), freq=400000)\npcf = PCF8574(i2c)\nhd44780 = HD44780(pcf, num_lines=2, num_columns=16)\nlcd = LCD(hd44780, pcf)\nlcd.backlight_on()\n```\n\nNow you can use the `lcd` object to control the LCD. For instance, to write a line of text to the display:\n\n```python\nlcd.write_line(\"Hello, world!\", 0)\n```\n\nTo create a scrolling text:\n\n```python\nlcd.marquee_text(\"Hello...\", 1, 0.2)\n```\n\nTo control the cursor and display:\n\n```python\nlcd.cursor_on()\nlcd.blink_on()\nutime.sleep(2)\nlcd.cursor_off()\nlcd.blink_off()\n```\n\nAnd to control the backlight:\n\n```python\nlcd.backlight_on()\nutime.sleep(2)\nlcd.backlight_off()\n```\n\n## Testing\n\nRun the `main_test` function in `test_main.py` to verify the library's functionality. This function will run a series of tests to demonstrate the capabilities of the library.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FThomascountz%2Fmicropython_i2c_lcd","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FThomascountz%2Fmicropython_i2c_lcd","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FThomascountz%2Fmicropython_i2c_lcd/lists"}