Simple test

Ensure your device works with this simple test.

examples/pixelmap_simpletest.py
 1# SPDX-FileCopyrightText: 2022 Tim Cocks for Adafruit Industries
 2# SPDX-License-Identifier: MIT
 3
 4"""
 5This example shows usage of the PixelMap helper to easily treat a single strip as a horizontal or
 6vertical grid for animation purposes.
 7
 8For NeoPixel FeatherWing. Update pixel_pin and pixel_num to match your wiring if using
 9a different form of NeoPixels. Note that if you are using a number of pixels other than 32, you
10will need to alter the PixelMap values as well for this example to work.
11
12This example does not work on SAMD21 (M0) boards.
13"""
14import time
15import board
16import neopixel
17from adafruit_pixelmap import PixelMap, horizontal_strip_gridmap
18
19# board.NEOPIXEL is the pin on the NeoTrellis M4.
20# Update to match the pin that your neopixels are connected to.
21pixel_pin = board.NEOPIXEL
22
23# Update to match the number of NeoPixels you have connected
24pixel_num = 32
25
26pixels = neopixel.NeoPixel(pixel_pin, pixel_num, brightness=0.1, auto_write=True)
27
28pixel_wing_vertical = PixelMap.vertical_lines(
29    pixels, 8, 4, horizontal_strip_gridmap(8, alternating=False)
30)
31pixel_wing_horizontal = PixelMap.horizontal_lines(
32    pixels, 8, 4, horizontal_strip_gridmap(8, alternating=False)
33)
34
35for i, row in enumerate(pixel_wing_horizontal):
36    pixels.fill(0x00000)
37    pixel_wing_horizontal[i] = 0x00FF00
38    time.sleep(0.3)
39
40for i, col in enumerate(pixel_wing_vertical):
41    pixels.fill(0x00000)
42    pixel_wing_vertical[i] = 0xFF00FF
43    time.sleep(0.3)
44
45while True:
46    pass