覆盆子皮AD8232

2024-10-01 09:21:33 发布

您现在位置:Python中文网/ 问答频道 /正文

我试图用树莓皮编程一个AD8232心脏监护仪,据我所知,我有所有正确的软件包安装为ump和adcads1115。我遇到的问题是,当我试图运行代码时,我得到一个值错误: 文件“/usr/lib/python2.7/dist packages/upm/pyupm_ad8232.py”,第170行,在init中 this=_pyupm_ad8232。新的\u ad8232(loPlus,loMinus,output,aref) 值错误: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()  

Tags: fromimportyoulosignalmaindefexit