The Adafruit_I2C.py module is now included in the Adafruit_BBIO library as a top-level module. This means that many of the popular Python libraries built for the Raspberry Pi, will now just work on the BeagleBone Black if they are using I2C, such as the BMP085 sensor library.

To use the module, it's as simple as importing it, and setting the I2C address, and optionally the bus (the default is I2C-1):
Copy Code
from Adafruit_I2C import Adafruit_I2C

i2c = Adafruit_I2C(0x77)
I2C requires the python package 'python-smbus' installed from your distribution's package manager (opkg or apt-get) in order to function properly. It was included as part of the Adafruit_BBIO installation instructions. python-smbus is only compatible with Python2 thus far.
The I2C SCL and SDA pins enabled by default are as follows:
Copy Code
P9_19: I2C2, SCL
P9_20: I2C2, SDA
Probe the I2C busses for connected devices:
Copy Code
i2cdetect -y -r 0
i2cdetect -y -r 1
Latest pydoc of the I2C module:
Copy Code
class Adafruit_I2C
|  Methods defined here:
|  
|  __init__(self, address, busnum=-1, debug=False)
|  
|  errMsg(self)
|  
|  readList(self, reg, length)
|      Read a list of bytes from the I2C device
|  
|  readS16(self, reg)
|      Reads a signed 16-bit value from the I2C device
|  
|  readS16Rev(self, reg)
|      Reads a signed 16-bit value from the I2C device with rev byte order
|  
|  readS8(self, reg)
|      Reads a signed byte from the I2C device
|  
|  readU16(self, reg)
|      Reads an unsigned 16-bit value from the I2C device
|  
|  readU16Rev(self, reg)
|      Reads an unsigned 16-bit value from the I2C device with rev byte order
|  
|  readU8(self, reg)
|      Read an unsigned byte from the I2C device
|  
|  reverseByteOrder(self, data)
|      Reverses the byte order of an int (16-bit) or long (32-bit) value
|  
|  write16(self, reg, value)
|      Writes a 16-bit value to the specified register/address pair
|  
|  write8(self, reg, value)
|      Writes an 8-bit value to the specified register/address
|  
|  writeList(self, reg, list)
|      Writes an array of bytes using I2C format
Last updated on 2014-04-18 at 08.31.12 PM Published on 2013-06-13 at 09.16.24 PM