我正在尝试使用Raspberry PI编程AD8232心脏监测器,据我所知,我为ump和ADC ads1115安装了所有正确的软件包。我遇到的问题是当我尝试运行代码时,我得到一个值错误: 在初始化文件“/usr/lib/python2.7/dist-packages/upm/pyupm_ad8232.py”,第170行 this = _pyupm_ad8232.new_AD8232(loPlus,loMinus,output,aref) ValueError:UPM无效参数:指定的AIO引脚无效 - 您有ADC吗? 任何人都可以帮助解决这个问题,我正在使用的python脚本如下 谢谢。
#!/usr/bin/env python3
from __future__ import print_function
import time, sys, signal, atexit
from upm import pyupm_ad8232 as upmAD8232
from upm import pyupm_ads1x15 as upm
def main():
# Instantiate a AD8232 sensor on digital pins 10 (LO+), 11 (LO-)
# and an analog pin, 0 (OUTPUT)
myAD8232 = upmAD8232.AD8232(10, 11, 8)
## Exit handlers ##
# This function stops python from printing a stacktrace when you hit
def SIGINTHandler(signum, frame):
raise SystemExit
# This function lets you run code on exit, including functions from myAD8232
def exitHandler():
print("Exiting")
sys.exit(0)
# Register exit handlers
atexit.register(exitHandler)
signal.signal(signal.SIGINT, SIGINTHandler)
# Output the raw numbers from the ADC, for plotting elsewhere.
# A return of 0 indicates a Lead Off (LO) condition.
# In theory, this data could be fed to software like Processing
# (https://www.processing.org/) to plot the data just like an
# EKG you would see in a hospital.
while(1):
print(myAD8232.value())
time.sleep(.001)
if __name__ == '__main__':
main()
答案 0 :(得分:0)
您可以使用ADS 1110或1115 n与覆盆子连接,将心率传感器的引脚连接到ADS 1110的A0引脚