sparkfun serlcd显示器的circuitpython驱动程序库
sparkfun-circuitpython-serlcd的Python项目详细描述
简介
sparkfun serlcd显示器的circuitpython库。这个图书馆是从 SparkFun SerLCD Arduino Library
SparkFun 16x2 SerLCD - Black on RGB 3.3V (LCD-14072)
SparkFun 16x2 SerLCD - RGB on Black 3.3V (LCD-14073)
SparkFun 20x4 SerLCD - Black on RGB 3.3V (LCD-14074)
依赖关系
此驱动程序取决于:
请确保circuitpython文件系统上的所有依赖项都可用。 这很容易通过下载来实现 the Adafruit library and driver bundle。
覆盆子皮设置
Adafruit has an excellent tutorial on Installing CircuitPython Libraries on Raspberry Pi.
快速入门摘要:
- 从配置了WiFi的最新版本的Raspbian开始。
- 启用ssh、i2c和spi。
sudo raspi-config
- 将系统更新到最新版本。
sudo apt-get update sudo apt-get upgrade
- 更新python工具
sudo pip3 install --upgrade setuptools
(如果未安装pip3,请安装它并重新运行命令)
sudo apt-get install python3-pip
- 安装circuitpython库
pip3 install RPI.GPIO pip3 install adafruit-blinka
从pypi安装
On supported GNU/Linux systems like the Raspberry Pi, you can install the driver locally from PyPI.
Installing this library will also install the dependency adafruit-circuitpython-busdevice.
从pypi安装
pip3 install sparkfun-circuitpython-serlcd
要在系统范围内安装(在某些情况下可能需要安装):
sudo pip3 install sparkfun-circuitpython-serlcd
在当前项目的虚拟环境中安装:
mkdir project-name &&cd project-name python3 -m venv .env source .env/bin/activate pip3 install adafruit-circuitpython-serlcd
用法示例
- Sparkfun SerLCD Hookup Guide-使用此库的python可以使用连接指南中的arduino示例
- CircuitPython on a Raspberry Pi-关于如何在覆盆子pi上安装circuitpython的基本信息。
- 代码示例:
# import the CircuitPython board and busio libraries import board import busio # Enable I2C (Qwiic) communication from sparkfun_serlcd import Sparkfun_SerLCD_I2C i2c= busio.I2C(board.SCL, board.SDA)serlcd= Sparkfun_SerLCD_I2C(i2c)# Enable SPI communication #import digitalio #from sparkfun_serlcd import Sparkfun_SerLCD_SPI #spi = busio.SPI(board.SCK, board.MOSI, board.MISO) # # Set up chip select, CE0 or D8 is labeled CS on Sparkfun Pi Hat #cs = digitalio.DigitalInOut(board.CE0) #cs.direction = digitalio.Direction.OUTPUT # #serlcd = Sparkfun_SerLCD_SPI(spi, cs) # Enable UART Serial communication # SerLCD is connected to the RPi via a USB to TTL 3.3v Serial Cable: # https://www.sparkfun.com/products/12977 # https://www.adafruit.com/product/954 #import serial #from sparkfun_serlcd import Sparkfun_SerLCD_UART # #usb0 = serial.Serial( # port='/dev/ttyUSB0', # baudrate = 9600, # parity=serial.PARITY_NONE, # stopbits=serial.STOPBITS_ONE, # bytesize=serial.EIGHTBITS, # timeout=1) # #serlcd = Sparkfun_SerLCD_UART(usb0)
贡献
欢迎投稿!请阅读我们的Code of Conduct 在帮助这个项目保持热情之前。
本地建筑
压缩发布文件
要在本地构建此库,您需要安装 circuitpython-build-tools包。
python3 -m venv .env
source .env/bin/activate
pip install circuitpython-build-tools
安装后,请确保您处于虚拟环境中:
source .env/bin/activate
然后运行生成:
circuitpython-build-bundles --filename_prefix sparkfun-circuitpython-serlcd --library_location .
斯芬克斯文件
sphinx用于根据代码中的rst文件和注释构建文档。第一, 安装依赖项(请随意重用上面的虚拟环境):
python3 -m venv .env
source .env/bin/activate
pip install Sphinx sphinx-rtd-theme
现在,激活虚拟环境后:
cd docs
sphinx-build -E -W -b html . _build/html
这将把文档输出到docs/_build/html。在浏览器中打开index.html以 查看它们。它还将(由于-w)错误的任何警告,像特拉维斯将。这是个很好的方法 本地验证它将通过。