Simple library to drive APA102 LED strips with an Adafruit FT232H breakout board over its SPI pins.
The packed format for the pixels is known from an exploration of the APA102 LEDs on Tim's Blog.
- Connect the LED strip to the first four pins:
5V
,GND
,D0
(CLK
-->CI
),D1
(MOSI
-->DI
) - Follow the Adafruit guide to install
adafruit-blinka
and setBLINKA_FT232H=1
in your environment - Import the library in Python:
from ft232h_dotstar import *
- Instantiate as
strip = Dotstar(SPI(), 10)
For example to create a simple rainbow fade on a strip with 10 dots:
$ python
Python 3.8.1 (default, Jan 8 2020, 23:09:20)
[GCC 9.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from ft232h_dotstar import *
>>> from time import sleep
>>> spi = SPI()
>>> spi.try_lock()
True
>>> spi.configure(30000000)
>>> strip = Dotstar(spi, 10)
>>> while True:
... for i in range(360):
... strip.rainbow(i/360, 120/360, 1, 1)
... sleep(0.01)
...