lorikeet_pi.py View on Little Bird ↗
"""Five Lorikeet LEDs on Pi 5 SPI0 MOSI (GPIO10 / physical pin 19).
Use a 5V-powered 74AHCT125 and a 330-ohm series data resistor.
"""
import time
import board
import neopixel_spi

LED_COUNT = 5
LEVEL = 24
HOLD_SECONDS = 1.0
spi = board.SPI()
pixels = neopixel_spi.NeoPixel_SPI(
    spi, LED_COUNT, brightness=1.0, auto_write=False,
    pixel_order=neopixel_spi.GRB,
)

try:
    print("Sending red, green and blue to five LEDs. Press Ctrl+C to stop.")
    while True:
        for colour in ((LEVEL, 0, 0), (0, LEVEL, 0), (0, 0, LEVEL)):
            pixels.fill(colour)             # Tuples are (red, green, blue).
            pixels.show()                  # Encode and send over SPI MOSI.
            time.sleep(HOLD_SECONDS)
except KeyboardInterrupt:
    print("Stopped; clearing the LEDs.")
finally:
    pixels.fill((0, 0, 0))
    pixels.show()
    pixels.deinit()
    spi.deinit()