Simple test

Ensure your device works with this simple test.

examples/pixie_simpletest.py
 1# SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries
 2# SPDX-License-Identifier: MIT
 3
 4import time
 5
 6import board
 7import busio
 8from rainbowio import colorwheel
 9
10import adafruit_pixie
11
12# For use with CircuitPython:
13uart = busio.UART(board.TX, rx=None, baudrate=115200)
14
15# For use on Raspberry Pi/Linux with Adafruit_Blinka:
16# import serial
17# uart = serial.Serial("/dev/ttyS0", baudrate=115200, timeout=3000)
18
19num_pixies = 2  # Change this to the number of Pixie LEDs you have.
20pixies = adafruit_pixie.Pixie(uart, num_pixies, brightness=0.2, auto_write=False)
21
22
23while True:
24    for i in range(255):
25        for pixie in range(num_pixies):
26            pixies[pixie] = colorwheel(i)
27        pixies.show()
28    time.sleep(2)
29    pixies[0] = (0, 255, 0)
30    pixies[1] = (0, 0, 255)
31    pixies.show()
32    time.sleep(1)
33    pixies.fill((255, 0, 0))
34    pixies.show()
35    time.sleep(1)
36    pixies[::2] = [(255, 0, 100)] * (2 // 2)
37    pixies[1::2] = [(0, 255, 255)] * (2 // 2)
38    pixies.show()
39    time.sleep(1)