Python package to support multi platform I2C bus integrations for the SparkFun qwiic ecosystem
This package can be used in conjunction with the overall SparkFun qwiic Python Package
New to qwiic? Take a look at the entire SparkFun qwiic ecosystem.
The qwiic I2C Python package current supports the following platforms:
The Raspberry Pi/Single Board Computer Linux driver of this package is dependent on smbus
The SparkFun qwiic I2C module documentation is hosted at ReadTheDocs
This repository is hosted on PyPi as the sparkfun-qwiic-i2c package. On systems that support PyPi installation via pip, this library is installed using the following commands
For all users (note: the user must have sudo privileges):
sudo pip install sparkfun-qwiic-i2c
For the current user:
pip install sparkfun-qwiic-i2c
To install, make sure the setuptools package is installed on the system.
Direct installation at the command line:
python setup.py install
To build a package for use with pip:
python setup.py sdist
A package file is built and placed in a subdirectory called dist. This package file can be installed using pip.
cd dist
pip install sparkfun_qwiic_i2c-<version>.tar.gz
This package is used extensively by the python modules for the SparkFun qwiic ecosystem. References to the modules can be found in the qwiic python package
General package use examples:
import qwiic_i2c
connectedDevices = i2cDriver.scan()
if myDeviceAddress in connectedDevices:
with qwiic_i2c.getI2CDriver() as i2c:
i2c.writeByte(myDeviceAddress, register, 0x3F)
import qwiic_i2c
>>> if qwiic_i2c.isDeviceConnected(myDeviceAddress):
with qwiic_i2c.getI2CDriver() as i2c:
i2c.writeByte(myDeviceAddress, register, 0x3F)