SparkFun Qwiic GPIO Hookup Guide

Pages
Contributors: El Duderino, Englandsaurus
Favorited Favorite 2

Qwiic GPIO Python Package

Note: This package assumes you are using the latest version of Python 3. If this is your first time using Python or I2C hardware on a Raspberry Pi, please checkout our tutorial on Python Programming with the Raspberry Pi and the Raspberry Pi SPI and I2C Tutorial.

Along with the Arduino Library, we've written a Python package to control the Qwiic GPIO. You can install the sparkfun-qwiic-gpio Python package hosted by PyPi or if you prefer to manually download and build the libraries from the GitHub repository, you can grab them by clicking the button below (*Please be aware of any package dependencies. You can also check out the repository documentation page, hosted on Read the Docs.):

Installation

Note: Don't forget to double check that the hardware I2C connection is enabled on your Raspberry Pi or other single board computer.

PyPi Installation

This repository is hosted on PyPi as the sparkfun-qwiic-gpio package. On systems that support PyPi installation via pip3 (use pip for Python 2) is simple using the following commands:

For all users (note: the user must have sudo privileges):

language:bash
sudo pip3 install sparkfun-qwiic-gpio

For the current user:

language:bash
pip3 install sparkfun-qwiic-gpio

Local Installation

To install, make sure the setuptools package is installed on the system.

Direct installation at the command line (use python for Python 2):

language:bash
python3 setup.py install

To build a package for use with pip3:

language:bash
python3 setup.py sdist

A package file is built and placed in a subdirectory called dist. This package file can be installed using pip3.

language:bash
cd dist
pip3 install sparkfun_qwiic_gpio-<version>.tar.gz

Dependencies

This Python package has a few dependencies in the code, listed below:

language:python
from __future__ import print_function
import math
import qwiic_i2c

Function Overview

For a full overview of all the functions included with the Qwiic GPIO Py package, head on over to the ReadtheDocs page.