Skip to main content

Python library for APA102 LEDs

Project description

# APA102 Library

[![Build Status](https://travis-ci.com/pimoroni/apa102-python.svg?branch=master)](https://travis-ci.com/pimoroni/apa102-python) [![Coverage Status](https://coveralls.io/repos/github/pimoroni/apa102-python/badge.svg?branch=master)](https://coveralls.io/github/pimoroni/apa102-python?branch=master) [![PyPi Package](https://img.shields.io/pypi/v/apa102.svg)](https://pypi-hypernode.com/pypi/apa102) [![Python Versions](https://img.shields.io/pypi/pyversions/apa102.svg)](https://pypi-hypernode.com/pypi/apa102)

# 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):

`python 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.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.1.tar.gz (4.1 kB view details)

Uploaded Source

Built Distributions

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

Uploaded Python 3

apa102-0.0.1-py2-none-any.whl (4.8 kB view details)

Uploaded Python 2

File details

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

File metadata

  • Download URL: apa102-0.0.1.tar.gz
  • Upload date:
  • Size: 4.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.0.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.6.9

File hashes

Hashes for apa102-0.0.1.tar.gz
Algorithm Hash digest
SHA256 1ef8d30ef6180cf7d7f58daffb410505bfc8ad4621396c9597dd8422d0226d45
MD5 3b155d757b511970680fb8e4643898af
BLAKE2b-256 6d77b93440ada6223fc94c74d755edf6bf2481a79b1a41bf4d621326731049e6

See more details on using hashes here.

File details

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

File metadata

  • Download URL: apa102-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 4.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.0.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.6.9

File hashes

Hashes for apa102-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 a9507b65290e1f63119265d25e8951f6927eb38b99ac5ce9b95af65dabc62bdf
MD5 c8c7c504b6d9d3b5dc07663644dbc3ba
BLAKE2b-256 13adebb9c470826516aa43a42d8803e52d858a6a6023b2ff4c69b48bbc9b809e

See more details on using hashes here.

File details

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

File metadata

  • Download URL: apa102-0.0.1-py2-none-any.whl
  • Upload date:
  • Size: 4.8 kB
  • Tags: Python 2
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.0.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.6.9

File hashes

Hashes for apa102-0.0.1-py2-none-any.whl
Algorithm Hash digest
SHA256 035c12e7c0ea548001c74a49f556e28ab4309939c8e8e6f89872b9a353d48b09
MD5 51470885327197140822916fd8eb42fb
BLAKE2b-256 7e0152a4f5a86d025d9ff58ab711e7727941950d59f18a876c269c3b5c85876b

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