Simple test¶
Ensure your device works with this simple test.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | # SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries
# SPDX-License-Identifier: MIT
import time
import board
import neopixel_spi as neopixel
NUM_PIXELS = 12
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)
|