Triple Axis Accelerometer Breakout - KX13x (Qwiic) Hookup Guide

Pages
Contributors: El Duderino, Englandsaurus, Elias The Sparkiest
Favorited Favorite 0

Qwiic KX13x Python Package

Note: This package and the included examples assume you are using the latest version of Python 3. If this is your first time using Python or I2C hardware on a Raspberry Pi, these tutorial can help you get started:

We've written a Python package to control the KX13x Breakouts for users who prefer a Raspberry Pi or other Python-specific development environment. You can install the sparkfun-qwiic-kx13x Python package hosted by PyPi through a command interface. If you prefer to manually download and build the libraries from the GitHub repository, you can download the package 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. The Raspberry Pi tutorials linked in the note above cover how to enable the Pi's I2C bus.

PyPi Installation

This repository is hosted on PyPi as the sparkfun-qwiic-kx13x 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-kx13x

For the current user:

language:bash
pip3 install sparkfun-qwiic-kx13x

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_kx13x-<version>.tar.gz

Qwiic KX13x Python Package Operation

For a full overview of all the functions included with the Qwiic KX13x Py package and how it works, take a look at the source code and package documentation hosted on ReadtheDocs page.

Upgrading the Python Package

If needed, the Python package can be upgraded using the following commands:

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

language:bash
sudo pip3 install --upgrade sparkfun-qwiic-kx13x

For the current user:

language:bash
pip3 install --upgrade sparkfun-qwiic-kx13x