APA102 Library
A simple library to drive APA102 pixels from the Raspberry Pi, or similar SBCs.
Uses either spidev or RPi.GPIO depending on the pins specified.
Pre-requisites
You must enable SPI:
- spi:
sudo raspi-config nonint do_spi 0
You can optionally run sudo raspi-config or the graphical Raspberry Pi Configuration UI to enable interfaces.
Installing
Stable library from PyPi:
- Just run
python3 -m pip install apa102
Latest/development library from GitHub:
git clone https://github.com/pimoroni/apa102-pythoncd apa102-pythonsudo ./install.sh
Usage
The APA102 class will attempt to use spidev or RPi.GPIO depending on which pins you specify.
For example; three RGB LEDs connected to SPI pins 10 and 11 with chip-select 8 (CE0):
from apa102 import APA102
lights = APA102(3, 10, 11, 8)
You can then set individual pixels with set_pixel:
lights.set_pixel(0, 255, 0, 0) # Pixel 1 to Red
lights.set_pixel(1, 0, 255, 0) # Pixel 2 to Green
lights.set_pixel(2, 0, 0, 255) # Pixel 3 to Blue
Pixels are zero-indexed and accept Red, Green and Blue colour values from 0 to 255.
Changelog
0.0.3
- Support SPI with cs None and no_cs
- Add support for inverted output (GPIO ONLY)
- Fix colour order to BGR
- Fix SOF, EOF and data lengths
- Drop noisy debug print from SPI mode
- Fix set_brightness so it doesn't break pixel SOF
- Add spi_max_speed_hz parameter
0.0.2
- Bugfixes and improvements
0.0.1
- Initial Release
Metadata
Release files for apa102 0.0.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| apa102-0.0.3.tar.gz | 4.5 kB | Without provenance | Details for apa102-0.0.3.tar.gz |
Built distributions (wheels)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| apa102-0.0.3-py3-none-any.whl | Python 3 | none | any | Details for apa102-0.0.3-py3-none-any.whl |
| apa102-0.0.3-py2-none-any.whl | Python 2 | none | any | Details for apa102-0.0.3-py2-none-any.whl |
Total release size: 13.1 kB
Release files / apa102-0.0.3.tar.gz
| Download URL | apa102-0.0.3.tar.gz |
|---|---|
| Size | 4.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ae73bdea26f027b57052ab990004ca8faa0f160d10bcacf5bd07e04769513cf9
|
|
BLAKE2b-256 checksum How to use checksums |
27531e423891e9e614ba37e05fab08aa83ba8c13128b36b49474dc72cf398e71
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.7.3
|
Release files / apa102-0.0.3-py3-none-any.whl
| Download URL | apa102-0.0.3-py3-none-any.whl |
|---|---|
| Size | 4.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
16ed5c6100a46645ca08d31a04e0182f6b21f431b4ff54ed508f83cf51af6478
|
|
BLAKE2b-256 checksum How to use checksums |
24baa8d7a68daba00e73c837dcf68f082a176b2f0afe0c24873c92f3634e4dd1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.7.3
|
Release files / apa102-0.0.3-py2-none-any.whl
| Download URL | apa102-0.0.3-py2-none-any.whl |
|---|---|
| Size | 4.3 kB |
| Tags | Python 2 |
|
SHA-256 checksum How to use checksums |
ee2833d4e161cfd47cc148be50a5d1855c345384a15b4bf592f6d0684c73930c
|
|
BLAKE2b-256 checksum How to use checksums |
0629236dd9fd2145885d673fda0ba7a1ea4739014f398b9be1154f07ef78acd1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.7.3
|
Security for apa102 0.0.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.