Just getting started, and I am having an issue with the following configuration:
Beaglebone Black Rev CDebian 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
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.
On Wed, 3 Oct 2018 20:15:04 -0700 (PDT), Chris Bohler
<chris.bohler@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)
did you install smbus?
It is a prerequisite.
— Graham