CircuitPython library for the Sparkfun Qwiic Relay
CircuitPython library for Sparkfun Qwiic Single Relay. This library is ported from examples at SparkFun Qwiic Relay
This driver depends on:
Please ensure all dependencies are available on the CircuitPython filesystem. This is easily achieved by downloading the Adafruit library and driver bundle or individual libraries can be installed using circup.
Raspberry Pi Setup
Adafruit has an excellent tutorial on Installing CircuitPython Libraries on Raspberry Pi.
Quick Start Summary:
- Start with the latest version of Raspbian with Wifi configured.
- Enable SSH, I2C and SPI.
- Update your system to the latest version.
sudo apt-get update sudo apt-get upgrade
- Update the python tools
sudo pip3 install --upgrade setuptools
(If pip3 is not installed, install it and rerun the command)
sudo apt-get install python3-pip
- Install the CircuitPython libraries
pip3 install RPI.GPIO pip3 install adafruit-blinka
Installing from PyPI
On supported GNU/Linux systems like the Raspberry Pi, you can install the driver locally from PyPI. To install for current user:
pip3 install sparkfun-circuitpython-qwiicrelay
To install system-wide (this may be required in some cases):
sudo pip3 install sparkfun-circuitpython-qwiicrelay
To install in a virtual environment in your current project:
mkdir project-name && cd project-name python3 -m venv .env source .env/bin/activate pip3 install sparkfun-circuitpython-qwiicrelay
Installing to a Connected CircuitPython Device with Circup
Make sure that you have circup installed in your Python environment. Install it with the following command if necessary:
pip3 install circup
With circup installed and your CircuitPython device connected use the following command to install:
circup install qwiicrelay
Or the following command to update an existing version:
- Qwiic Single Relay Hookup Guide - The Arduino examples in the Hookup Guide are available for Python with this library
- CircuitPython on a Raspberry Pi - Basic information on how to install CircuitPython on a Raspberry Pi.
- Code Example:
# import the CircuitPython board and busio libraries import board # Create bus object using the board's I2C port i2c = board.I2C() relay = QwiicRelay(i2c) # default address is 0x18 # For a different address use QwiicRelay(i2c, address) # relay = QwiicRelay(i2c, 0x19)
On supported GNU/Linux systems like the Raspberry Pi, you can upgrade the driver to the latest published version.
To upgrade for current user:
pip3 install --upgrade sparkfun-circuitpython-qwiicjoystick
To upgrade system-wide (this may be required in some cases):
sudo pip3 install --upgrade sparkfun-circuitpython-qwiicjoystick
Contributions are welcome! Please read our Code of Conduct before contributing to help this project stay welcoming.
For information on building library documentation, please check out this guide.
Zip release files
To build this library locally you’ll need to install the circuitpython-build-tools package.
python3 -m venv .env source .env/bin/activate pip install circuitpython-build-tools
Once installed, make sure you are in the virtual environment:
Then run the build:
circuitpython-build-bundles --filename_prefix sparkfun-circuitpython-qwiicrelay --library_location .
This product is open source!
Please review the LICENSE.md file for license information.
Please use, reuse, and modify these files as you see fit.
Please maintain the attributions to SparkFun Electronics and Adafruit and release any derivative under the same license.
Distributed as-is; no warranty is given.
Release history Release notifications | RSS feed
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Hashes for sparkfun-circuitpython-qwiicrelay-1.0.6.tar.gz