CircuitPython库,用于SSD1306 OLED显示屏。
项目描述
简介
Adafruit CircuitPython驱动程序,用于SSD1306或SSD1305 OLED显示屏。请注意,SSD1305显示屏向后兼容,因此可以使用与SSD1306相同的代码和命令替换。
此驱动程序实现了adafruit_framebuf接口。它不是SSD1306的displayio驱动程序。有关displayio支持,请参阅Adafruit CircuitPython DisplayIO SSD1306驱动程序。
依赖项
此驱动程序依赖于
请确保所有依赖项都在CircuitPython文件系统中可用。这可以通过下载Adafruit库和驱动程序包轻松实现。
从PyPI安装
在支持GNU/Linux系统(如Raspberry Pi)上,您可以从PyPI本地安装驱动程序。安装当前用户
pip3 install adafruit-circuitpython-ssd1306
安装系统(在某些情况下可能需要)
sudo pip3 install adafruit-circuitpython-ssd1306
在当前项目的虚拟环境中安装
mkdir project-name && cd project-name
python3 -m venv .venv
source .venv/bin/activate
pip3 install adafruit-circuitpython-ssd1306
使用示例
# Basic example of clearing and drawing pixels on a SSD1306 OLED display.
# This example and library is meant to work with Adafruit CircuitPython API.
# Author: Tony DiCola
# License: Public Domain
# Import all board pins.
from board import SCL, SDA
import busio
# Import the SSD1306 module.
import adafruit_ssd1306
# Create the I2C interface.
i2c = busio.I2C(SCL, SDA)
# Create the SSD1306 OLED class.
# The first two parameters are the pixel width and pixel height. Change these
# to the right size for your display!
display = adafruit_ssd1306.SSD1306_I2C(128, 32, i2c)
# Alternatively you can change the I2C address of the device with an addr parameter:
#display = adafruit_ssd1306.SSD1306_I2C(128, 32, i2c, addr=0x31)
# Clear the display. Always call show after changing pixels to make the display
# update visible!
display.fill(0)
display.show()
# Set a pixel in the origin 0,0 position.
display.pixel(0, 0, 1)
# Set a pixel in the middle 64, 16 position.
display.pixel(64, 16, 1)
# Set a pixel in the opposite 127, 31 position.
display.pixel(127, 31, 1)
display.show()
更多示例和详情请参阅adafruit_framebuf文档。
文档
该库的API文档可以在Read the Docs上找到。
有关构建库文档的信息,请参阅本指南。
贡献
欢迎贡献!在为此项目做出贡献之前,请阅读我们的行为准则,以帮助保持项目的友好氛围。
项目详情
关闭
哈希值(adafruit_circuitpython_ssd1306-2.12.17-py3-none-any.whl)
算法 | 哈希摘要 | |
---|---|---|
SHA256 | f622aff5f9d7f7524abec38af765748ac807c1e7b6b0079d8c13078a76e5c106 |
|
MD5 | 37ae9a0c1431c7fe416c59f7e79e4eb9 |
|
BLAKE2b-256 | f19ee5ce66568a2b394286b636dfe08c43f1ed8abbe461383976f54f6afe64d6 |