FB Color LED
ドライバのインストール
JupyterlabのTerminalを起動しドライバをインストールします。
pip3 install adafruit-circuitpython-neopixel-spi
サンプルコード
https://github.com/adafruit/Adafruit_CircuitPython_NeoPixel_SPI/blob/main/examples/neopixel_spi_simpletest.py
import board
import neopixel_spi
pixels = neopixel_spi.NeoPixel_SPI(board.SPI(), 10)
pixels.fill(0x00ffff)
# SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries
# SPDX-License-Identifier: MIT
import time
import board
import neopixel_spi as neopixel
NUM_PIXELS = 10
PIXEL_ORDER = neopixel.GRB
COLORS = (0xFF0000, 0x00FF00, 0x0000FF)
DELAY = 0.1
spi = board.SPI()
pixels = neopixel.NeoPixel_SPI(
spi, NUM_PIXELS, pixel_order=PIXEL_ORDER, auto_write=False
)
while True:
for color in COLORS:
for i in range(NUM_PIXELS):
pixels[i] = color
pixels.show()
time.sleep(DELAY)
pixels.fill(0)