-
Notifications
You must be signed in to change notification settings - Fork 0
/
matrix_i75.py
78 lines (62 loc) · 2.03 KB
/
matrix_i75.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
"""
matrix_i75.py
matrix code-like effect
"""
import time
import random
import board # pylint: disable=import-error
import displayio # pylint: disable=import-error
import framebufferio # pylint: disable=import-error
import rgbmatrix # pylint: disable=import-error
def code_line():
"""
generate a vertical line of pixels
"""
palette1 = displayio.Palette(8)
pos = 0
for i in range(16,128,16):
palette1[pos] = (0, i, 0)
pos += 1
palette1[7] = (255, 255, 255)
bitmap1 = displayio.Bitmap(1, 8, 8)
pos = 0
for i in range(8):
bitmap1[0, pos] = pos
pos += 1
return displayio.TileGrid(bitmap1, pixel_shader=palette1)
def main():
"""
they call it main.
"""
# get rid of any pre-existing display
displayio.release_displays()
# interstate75 32x32 or 64x32
# bit_depth can be 1 to 6
matrix = rgbmatrix.RGBMatrix(
width=64, height=32, bit_depth=6,
rgb_pins=[board.R0, board.G0, board.B0, board.R1, board.G1, board.B1],
addr_pins=[board.ROW_A, board.ROW_B, board.ROW_C, board.ROW_D],
clock_pin=board.CLK, latch_pin=board.LAT, output_enable_pin=board.OE)
# interstate75 64x64
# matrix = rgbmatrix.RGBMatrix(
# width=64, height=64, bit_depth=6,
# rgb_pins=[board.R0, board.G0, board.B0, board.R1, board.G1, board.B1],
# addr_pins=[board.ROW_A, board.ROW_B, board.ROW_C, board.ROW_D, board.ROW_E],
# clock_pin=board.CLK, latch_pin=board.LAT, output_enable_pin=board.OE)
display = framebufferio.FramebufferDisplay(matrix, auto_refresh=True)
g = displayio.Group()
while True:
group1 = displayio.Group()
tile1 = code_line()
group1.append(tile1)
group1.x = random.randint(0, matrix.width)
group1.y = -8
g.append(group1)
display.show(g)
time.sleep(2)
pos = group1.y
for i in range(pos, matrix.height + 8):
time.sleep(0.05)
group1.y = i
if __name__ == "__main__":
main()