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