sparkfun qwiic旋转编码器电路python
adafruit-circuitpython-qwiictwist的Python项目详细描述
依赖关系
此驱动程序取决于:
请确保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-qwiictwist
要在系统范围内安装(在某些情况下可能需要安装):
sudo pip3 install sparkfun-circuitpython-qwiictwist
在当前项目的虚拟环境中安装:
mkdir project-name &&cd project-name python3 -m venv .env source .env/bin/activate pip3 install sparkfun-circuitpython-qwiictwist
用法示例
- Qwiic Twist Hookup Guide-使用此库的python可以使用连接指南中的arduino示例
- CircuitPython on a Raspberry Pi-关于如何在覆盆子pi上安装circuitpython的基本信息。
- 代码示例:
# import the CircuitPython board and busio libraries import board import busio # Create bus object using the board's I2C port i2c= busio.I2C(board.SCL, board.SDA)twist= QwiicTwist(i2c)# default address is 0x3F # For a different address use QwiicTwist(i2c, address) # twist = QwiicTwist(i2c, 0x3E)
贡献
欢迎投稿!请阅读我们的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-qwiictwist --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)错误的任何警告,像特拉维斯将。这是个很好的方法 本地验证它将通过。
许可证信息
这个产品是开源的!
有关许可证信息,请查看license.md文件。
请根据需要使用、重用和修改这些文件。
请保留Sparkfun Electronics和Adafruit的所有权,并在同一许可证下发布任何衍生产品。
按原样分发;不提供任何保证。