Adafruit i2c install issue

747 views
Skip to first unread message

Chris Bohler

unread,
Oct 3, 2018, 11:15:04 PM10/3/18
to BeagleBoard
Just getting started, and I am having an issue with the following configuration:

Beaglebone Black Rev C
Debian 4.14
Python 2.7

When attempt to execute Adafruit_BBIO.I2C as I2C:
   "Adafruit_BBIO.I2C deprecated. Replace with Adafruit_GPIO.I2C"

However, after cloning the Adafruit_Python_GPIO module, and running setup.py install ...

... I receive the following:

Traceback (most recent call last):
  File "/var/lib/cloud9/examples/test_accel.py", line 6, in <module>
    Accel = I2C.Device(0x1c, 2)
  File "/usr/local/lib/python2.7/dist-packages/Adafruit_GPIO-1.0.3-py2.7.egg/Adafruit_GPIO/I2C.py", line 98, in __init__
    import Adafruit_PureIO.smbus
ImportError: No module named Adafruit_PureIO.smbus

This from simple python code:

import Adafruit_GPIO.I2C as I2C
import Adafruit_BBIO.GPIO as GPIO

Accel = I2C.Device(0x1c, 2)



I have not been able to determine how to install PureIO library. Comments on github suggest it may not have been released yet.

So, if Adafruit_BBIO retired, and Adafruit_PureIO not available, what should I be installing for an i2c library that is compatible with debian 4.14?

Thanks for any help anyone can provide.

Chris Bohler

unread,
Oct 3, 2018, 11:19:38 PM10/3/18
to BeagleBoard
Correction: Debian 9.5

Dennis Lee Bieber

unread,
Oct 4, 2018, 11:34:26 AM10/4/18
to beagl...@googlegroups.com
On Wed, 3 Oct 2018 20:15:04 -0700 (PDT), Chris Bohler
<chris....@sbcglobal.net> declaimed the
following:

>
>When attempt to execute Adafruit_BBIO.I2C as I2C:
> "Adafruit_BBIO.I2C deprecated. Replace with Adafruit_GPIO.I2C"
>

Note the message says "deprecated", not that it is no longer usable.


> File
>"/usr/local/lib/python2.7/dist-packages/Adafruit_GPIO-1.0.3-py2.7.egg/Adafruit_GPIO/I2C.py",
>line 98, in __init__
> import Adafruit_PureIO.smbus
>ImportError: No module named Adafruit_PureIO.smbus
>

Looking at the source code for I2C

"""
def __init__(self, address, busnum, i2c_interface=None):
"""Create an instance of the I2C device at the specified address on
the
specified I2C bus number."""
self._address = address
if i2c_interface is None:
# Use pure python I2C interface if none is specified.
import Adafruit_PureIO.smbus
self._bus = Adafruit_PureIO.smbus.SMBus(busnum)
else:
# Otherwise use the provided class to create an smbus
interface.
self._bus = i2c_interface(busnum)
"""

you can bypass Adafruit_PureIO by providing your own interface object. I
have not looked deeper into what such an object would be.

>This from simple python code:
>
>import Adafruit_GPIO.I2C as I2C
>import Adafruit_BBIO.GPIO as GPIO

I suspect if you are using Adafruit_GPIO you should also use

import Adafruit_GPIO.GPIO as GPIO

(that, itself, imports Adafruit_BBIO)



--
Wulfraed Dennis Lee Bieber AF6VN
wlf...@ix.netcom.com HTTP://wlfraed.home.netcom.com/

Graham Haddock

unread,
Oct 4, 2018, 3:40:53 PM10/4/18
to BeagleBoard
did you install smbus?
It is a prerequisite.
--- Graham

--
For more options, visit http://beagleboard.org/discuss
---
You received this message because you are subscribed to the Google Groups "BeagleBoard" group.
To unsubscribe from this group and stop receiving emails from it, send an email to beagleboard...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/beagleboard/gtbcrd585viblrvujp5e3ntgo6nq0pjkgl%404ax.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages