LinuxDevice

class electronics.gateways.linuxdevice.LinuxDevice(i2c_bus_index)

Class for using a i2c master that is supported by a Linux kernel module. An example is the internal smbus in a computer motherboard (supported by i2c-dev) or the i2c connection on the Raspberry Pi (supported by i2c-bcm2708). Linux gives every i2c bus a number. For the Raspberry Pi 2 this is “1”

Example:
>>> from electronics.gateways import LinuxDevice
>>> # Open /dev/i2c-1
>>> gw = LinuxDevice(1) 
Parameters:i2c_bus_index – The number of the i2c bus.