Skip to content

Commit 7c33258

Browse files
authored
Merge pull request #7 from FoamyGuy/single_panel_simpletest
single panel simpletest
2 parents 101a796 + 443f6ee commit 7c33258

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

examples/single_panel_simpletest.py

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
#!/usr/bin/python3
2+
# SPDX-FileCopyrightText: 2025 Tim Cocks for Adafruit Industries
3+
#
4+
# SPDX-License-Identifier: MIT
5+
"""
6+
Display a simple test pattern of 3 shapes on a single 64x32 matrix panel.
7+
8+
Run like this:
9+
10+
$ python simpletest.py
11+
12+
"""
13+
14+
import adafruit_raspberry_pi5_piomatter
15+
import numpy as np
16+
from PIL import Image, ImageDraw
17+
18+
width = 64
19+
height = 32
20+
21+
geometry = adafruit_raspberry_pi5_piomatter.Geometry(width=width, height=height, n_addr_lines=4, rotation=adafruit_raspberry_pi5_piomatter.Orientation.Normal)
22+
23+
canvas = Image.new('RGB', (width, height), (0, 0, 0))
24+
draw = ImageDraw.Draw(canvas)
25+
26+
framebuffer = np.asarray(canvas) + 0 # Make a mutable copy
27+
matrix = adafruit_raspberry_pi5_piomatter.AdafruitMatrixBonnetRGB888Packed(framebuffer, geometry)
28+
29+
draw.rectangle((2,2, 10,10), fill=0x008800)
30+
draw.circle((18,6), 4, fill=0x880000)
31+
draw.polygon([(28, 2), (32, 10), (24, 10)], fill=0x000088)
32+
33+
framebuffer[:] = np.asarray(canvas)
34+
matrix.show()
35+
36+
input("Press enter to exit")

0 commit comments

Comments
 (0)