Error using python Adafruit_BBIO GPIO and ADC and

2019-08-14 06:04发布

问题:

I'm trying to use python and import Adafruit_BBIO.GPIO and import Adafruit_BBIO.ADC to read from some pins while I write to others. But I keep getting this error:

Traceback (most recent call last): File "wajeeh.py", line 4, in ADC.setup() RuntimeError: Unable to setup ADC system. Possible causes are: - A cape with a conflicting pin mapping is loaded - A device tree object is loaded that uses the same name for a fragment: helper

here is my code:

import Adafruit_BBIO.GPIO as GPIO #import GPIO Library
import Adafruit_BBIO.ADC as ADC

ADC.setup()

outPinA = "P9_12"                    #set outPinA 
outPinB = "P9_14"                   #set outPinB  

GPIO.setup(outPinA, GPIO.OUT)       #make outPin an Output
GPIO.setup(outPinB, GPIO.OUT)

while 1:
    GPIO.output(outPinA, GPIO.HIGH)
    GPIO.output(outPinB, GPIO.LOW)
    sleep(10)
    GPIO.output(outPinA, GPIO.LOW)
    GPIO.output(outPinB, GPIO.LOW)
    sleep(10)
    GPIO.output(outPinA, GPIO.LOW)
    GPIO.output(outPinB, GPIO.HIGH) # Set outPin LOW
    sleep(10)                       
    GPIO.output(outPinA, GPIO.LOW)
    GPIO.output(outPinB, GPIO.LOW)
    sleep(10)                       
GPIO.cleanup()                     #Release your pins

回答1:

A similar issue has been solved in a later version of ADC. See: issue 90

Try uninstalling Adafruit_BBIO, and then installing from the git repository:

pip uninstall Adafruit_BBIO
git clone https://github.com/adafruit/adafruit-beaglebone-io-python/
cd adafruit-beaglebone-io-python
python setup.py install