follow on Twitter

SparkFun Qwiic Joystick Breakout

Python module for the qwiic joystick, which is part of the SparkFun Qwiic Joystick

This python package is a port of the existing SparkFun Qwiic Joystick Arduino Library

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.


This driver package depends on the qwiic I2C driver: Qwiic_I2C_Py


The SparkFun qwiic Joystick module documentation is hosted at ReadTheDocs


PyPi Installation

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

For the current user:

pip install sparkfun-qwiic-joystick

Local Installation

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

Example Use

See the examples directory for more detailed use examples.

from __future__ import print_function
import qwiic_joystick
import time
import sys

def runExample():

    print("\nSparkFun qwiic Joystick   Example 1\n")
    myJoystick = qwiic_joystick.QwiicJoystick()

    if myJoystick.isConnected() == False:
        print("The Qwiic Joystick device isn't connected to the system. Please check your connection", \


    print("Initialized. Firmware Version: %s" % myJoystick.getVersion())

    while True:

        print("X: %d, Y: %d, Button: %d" % ( \
                    myJoystick.getHorizontal(), \
                    myJoystick.getVertical(), \


if __name__ == '__main__':
    except (KeyboardInterrupt, SystemExit) as exErr:
        print("\nEnding Example 1")

SparkFun - Start Something

Indices and tables