Skip to content
This repository was archived by the owner on Aug 25, 2025. It is now read-only.
This repository was archived by the owner on Aug 25, 2025. It is now read-only.

Problem running PyBBIO ADC code on BBB attached to 4D Systems 4DCAPE #98

@akerbay

Description

@akerbay

Alex:
I just now installed your PyBBIO and am having a problem with analogRead. My BBB is attached to a 4D_Systems 4DCAPE, and apparently that's causing the problem. Have a similar problem with Adafruit ADC code. Is the problem fixable? (BTW, PyBBIO PWM output works fine.)

http://www.4dsystems.com.au/product/4DCAPE_70T/

Traceback (most recent call last):
File "/var/lib/cloud9/ADC_Test.py", line 23, in
run(setup, loop)
File "/usr/local/lib/python2.7/dist-packages/bbio/bbio.py", line 60, in run
loop()
File "/var/lib/cloud9/ADC_Test.py", line 13, in loop
val1 = analogRead(pot1)
File "/usr/local/lib/python2.7/dist-packages/bbio/platform/beaglebone/adc.py", line 30, in analogRead
cape_manager.load(ADC_ENABLE_DTS_OVERLAY, auto_unload=False)
File "/usr/local/lib/python2.7/dist-packages/bbio/platform/beaglebone/cape_manager.py", line 27, in load
f.write(overlay)
IOError: [Errno 17] File exists

Here's my program:

Import PyBBIO library:

from bbio import *

pot1 = AIN4 # pin 33 on header P9
pot2 = AIN5 # pin 36 on header P9

def setup():

Nothing to do here

pass

def loop():

Get the ADC values:

val1 = analogRead(pot1)
val2 = analogRead(pot2)

And convert to voltages:

voltage1 = inVolts(val1)
voltage2 = inVolts(val2)
print " pot1 ADC value: %i - voltage: %fv" % (val1, voltage1)
print " pot2 ADC value: %i - voltage: %fv\n" % (val2, voltage2)
delay(500)

Start the loop:

run(setup, loop)

Thanks for your help.
John

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions