A thread-based Python library to control WS281X LEDs (AdaFruits NeoPixels).
(Dependencies are installed automatically with this method.)
git clone https://github.com/So-Cool/neopixel-python.git
cd neopixel-python
pip install .
This library requires rpi_ws281x
and its corresponding Python library.
It can be installed either with pip
(recommended) or manually -- see below.
Detailed installation instructions are available on AdaFruit's website.
sudo pip install rpi_ws281x
If you want to install the rpi_ws281x
library manually:
# Update OS packages
sudo apt-get update
sudo apt-get install build-essential python-dev git scons swig
# Install WS281X driver...
git clone https://github.com/jgarff/rpi_ws281x.git
cd rpi_ws281x
scons
# ...and the corresponding Python package
sudo pip install rpi_ws281x
# `cd python && sudo python setup.py install` has been deprecated
Test with: rpi_ws281x/python/examples/strandtest.py
.
Adjust LED_PIN
to 13 or 18 and LED_CHANNEL
0 to 1.
This library is distributed with a file (neopixel_python/neopixel.py
) adapted from the rpi_ws281x
library.
It is required for the proper functioning of this package but it is not distributed with the pip's version of rpi_ws281x
, which superseded the Python library distributed as a part of rpi_ws281x
.
- Consider Unicorn Hat as a Linux service written in C and controlled from Python instead. Also have a look at Unicorn Paint and OctaPi's use of Unicorn Hat.