Python module for the SparkFun Qwiic Mux Breakout - 8 Channel (TCA9548A).
This package should 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 TCA9548A Python package current supports the following platforms:
This package depends on the qwiic I2C driver: Qwiic_I2C_Py
The SparkFun qwiic TCA9548A module documentation is hosted at ReadTheDocs
This repository is hosted on PyPi as the sparkfun-qwiic-tca9548a 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-tca9548a
For the current user:
pip install sparkfun-qwiic-tca9548a
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_tca9548a-<version>.tar.gz
See the examples directory for more detailed use examples.
import qwiic_tca9548a
import time
import sys
def runExample():
print("\nSparkFun TCA9548A Example 1\n")
test = qwiic_tca9548a.QwiicTCA9548A()
if test.is_connected() == False:
print("The Qwiic TCA9548A device isn't connected to the system. Please check your connection", \
file=sys.stderr)
return
try:
test.list_channels()
time.sleep(2)
test.enable_channels([4,5])
test.list_channels()
time.sleep(2)
test.disable_channels(5)
test.list_channels()
time.sleep(2)
except Exception as e:
print(e)