Skip to main content

Python library for APA102 LEDs

Project description

APA102 Library

Build Status Coverage Status PyPi Package Python Versions

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-python
  • cd apa102-python
  • sudo ./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.2

  • Bugfixes and improvements

0.0.1

  • Initial Release

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

apa102-0.0.2.tar.gz (4.1 kB view details)

Uploaded Source

Built Distributions

apa102-0.0.2-py3-none-any.whl (4.0 kB view details)

Uploaded Python 3

apa102-0.0.2-py2-none-any.whl (4.0 kB view details)

Uploaded Python 2

File details

Details for the file apa102-0.0.2.tar.gz.

File metadata

  • Download URL: apa102-0.0.2.tar.gz
  • Upload date:
  • Size: 4.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.15.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/44.1.1 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/2.7.17

File hashes

Hashes for apa102-0.0.2.tar.gz
Algorithm Hash digest
SHA256 0c071352f95c6cd42a9adf21503b1e1312c44628bbf76e3f51afe3b08a3b24c4
MD5 7232595865206fb31dd0e53421366599
BLAKE2b-256 fa4b51cf47d61e5601d6fb4a0b941309f03d2a9fdba35fd5085b84aa561d0b01

See more details on using hashes here.

File details

Details for the file apa102-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: apa102-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 4.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.15.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/44.1.1 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/2.7.17

File hashes

Hashes for apa102-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 fe7da84d2d9506005be69604d04a3093cad40b91f7e3fb998d753fbc7fa8182a
MD5 51b5bec06be56840984dfe821edfa363
BLAKE2b-256 57093cb7fee302d98877e8f4c1a2d3fc52d0de892cbf4bab533f97a9c201bd9a

See more details on using hashes here.

File details

Details for the file apa102-0.0.2-py2-none-any.whl.

File metadata

  • Download URL: apa102-0.0.2-py2-none-any.whl
  • Upload date:
  • Size: 4.0 kB
  • Tags: Python 2
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.15.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/44.1.1 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/2.7.17

File hashes

Hashes for apa102-0.0.2-py2-none-any.whl
Algorithm Hash digest
SHA256 1dc8b298d67068bd559ae088d127f19ab81019272948bd275b8216292e119b64
MD5 c719bd4679f1964eb78382a422437122
BLAKE2b-256 caaf84be4baded845dd13aa7d5134b1c7822a2532ce1b479f9a8b4d23ae6ec2b

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page