CircuitPython库,用于HT16K33 LED矩阵和段式显示屏。
项目描述
简介
这是一个用于使用基于I²C的LED矩阵和HT16K33芯片的库。它支持16x8和8x8矩阵,以及7段和14段显示。
注意事项
此库旨在与Adafruit CircuitPython的API兼容。对于与MicroPython机器API兼容的库,请参阅此 库。
此库不适用于Trellis 4x4 LED+键盘板。对于该产品,请使用: CircuitPython Trellis库
依赖项
此驱动程序依赖于
请确保所有依赖项都可在CircuitPython文件系统中使用。这可以通过下载 Adafruit库和驱动程序包 来轻松实现。
从PyPI安装
在支持GNU/Linux的系统上,如树莓派,您可以从PyPI本地安装驱动程序。要为当前用户安装
pip3 install adafruit-circuitpython-ht16k33
要全局安装(在某些情况下可能需要)
sudo pip3 install adafruit-circuitpython-ht16k33
要在当前项目的虚拟环境中安装
mkdir project-name && cd project-name
python3 -m venv .venv
source .venv/bin/activate
pip3 install adafruit-circuitpython-ht16k33
使用示例
# Import all board pins and bus interface.
import board
import busio
# Import the HT16K33 LED matrix module.
from adafruit_ht16k33 import matrix
# Create the I2C interface.
i2c = busio.I2C(board.SCL, board.SDA)
# Create the matrix class.
# This creates a 16x8 matrix:
matrix = matrix.Matrix16x8(i2c)
# Or this creates a 8x8 matrix:
#matrix = matrix.Matrix8x8(i2c)
# Or this creates a 8x8 bicolor matrix:
#matrix = matrix.Matrix8x8x2
# Finally you can optionally specify a custom I2C address of the HT16k33 like:
#matrix = matrix.Matrix16x8(i2c, address=0x70)
# Clear the matrix.
matrix.fill(0)
# Set a pixel in the origin 0,0 position.
matrix[0, 0] = 1
# Set a pixel in the middle 8, 4 position.
matrix[8, 4] = 1
# Set a pixel in the opposite 15, 7 position.
matrix[15, 7] = 1
matrix.show()
# Change the brightness
matrix.brightness = 8
# Set the blink rate
matrix.blink_rate = 2
文档
此库的API文档可以在 Read the Docs 上找到。
有关构建库文档的信息,请参阅本指南。
贡献
欢迎贡献!在为该项目做出贡献之前,请阅读我们的行为准则,以帮助保持该项目对所有人友好。
项目详情
关闭
adafruit-circuitpython-ht16k33-4.6.9.tar.gz的哈希值
算法 | 哈希摘要 | |
---|---|---|
SHA256 | 38531f11a2b9cba63b68abd9af11ec8d479c19bf5e380ad4f977c2bb20a410c5 |
|
MD5 | e6c5bbb12ab5952969f43c6a774673af |
|
BLAKE2b-256 | 98cef50ae90a39fd06e4ad59ab69ccee9c1d43144bc4cdab4d36dd877ad24cd1 |
关闭
adafruit_circuitpython_ht16k33-4.6.9-py3-none-any.whl的哈希值
算法 | 哈希摘要 | |
---|---|---|
SHA256 | 2634f2d2b4823e023d778e9914f5bfe0189040c56f5da70d4c5ad10ac13f791e |
|
MD5 | 7f95212649649c7d3d997c0a537a5083 |
|
BLAKE2b-256 | 27baba565ef9c3b5872b0b1eb714a2c6f74bb84c90fdd04119e65ff5227a7395 |