ADC+DAC组合
项目描述
简介
ADC+DAC组合
依赖项
此驱动程序依赖于
请确保所有依赖项都在CircuitPython文件系统中可用。这可以通过下载 Adafruit库和驱动程序捆绑包 来轻松实现。
从PyPI安装
在支持GNU/Linux系统(如Raspberry Pi)上,您可以从PyPI 本地安装此驱动程序。为当前用户安装
pip3 install adafruit-circuitpython-pcf8591
要系统范围安装(在某些情况下可能需要)
sudo pip3 install adafruit-circuitpython-pcf8591
在您当前项目的虚拟环境中安装
mkdir project-name && cd project-name
python3 -m venv .venv
source .venv/bin/activate
pip3 install adafruit-circuitpython-pcf8591
使用示例
import time
import board
import adafruit_pcf8591.pcf8591 as PCF
from adafruit_pcf8591.analog_in import AnalogIn
from adafruit_pcf8591.analog_out import AnalogOut
############# AnalogOut & AnalogIn Example ##########################
#
# This example shows how to use the included AnalogIn and AnalogOut
# classes to set the internal DAC to output a voltage and then measure
# it with the first ADC channel.
#
# Wiring:
# Connect the DAC output to the first ADC channel, in addition to the
# normal power and I2C connections
#
#####################################################################
i2c = board.I2C()
pcf = PCF.PCF8591(i2c)
pcf_in_0 = AnalogIn(pcf, PCF.A0)
pcf_out = AnalogOut(pcf, PCF.OUT)
while True:
print("Setting out to ", 65535)
pcf_out.value = 65535
raw_value = pcf_in_0.value
scaled_value = (raw_value / 65535) * pcf_in_0.reference_voltage
print("Pin 0: %0.2fV" % (scaled_value))
print("")
time.sleep(1)
文档
此库的API文档可以在 Read the Docs 上找到。
有关构建库文档的信息,请参阅 本指南。
贡献
欢迎贡献!在向本项目做出贡献之前,请阅读我们的 行为准则,以帮助本项目保持友好。
项目详情
关闭
哈希值 for adafruit_circuitpython_pcf8591-1.0.18-py3-none-any.whl
算法 | 哈希摘要 | |
---|---|---|
SHA256 | ce0d0e251c9c833319975497f1d11c105da635ee59ad91073952c78a4757deeb |
|
MD5 | 9668bc14c13e913dba4677446d27e22f |
|
BLAKE2b-256 | a67c341ef006a62873ea3b32b5354c4b9ae928faf6b6c842e1a217d4b122cd8b |