Simple test

Ensure your device works with this simple test.

examples/neopixel_spi_simpletest.py
 1# SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries
 2# SPDX-License-Identifier: MIT
 3
 4import time
 5import board
 6import neopixel_spi as neopixel
 7
 8NUM_PIXELS = 12
 9PIXEL_ORDER = neopixel.GRB
10COLORS = (0xFF0000, 0x00FF00, 0x0000FF)
11DELAY = 0.1
12
13spi = board.SPI()
14
15pixels = neopixel.NeoPixel_SPI(
16    spi, NUM_PIXELS, pixel_order=PIXEL_ORDER, auto_write=False
17)
18
19while True:
20    for color in COLORS:
21        for i in range(NUM_PIXELS):
22            pixels[i] = color
23            pixels.show()
24            time.sleep(DELAY)
25            pixels.fill(0)