-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwemos_mx7219.py
98 lines (86 loc) · 1.79 KB
/
wemos_mx7219.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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
from machine import Signal, Pin
import mled
pixelart = {
'heart': 0x00367F7F3E1C0800,
'pacman': 0x3c4221111121423c,
'ghost': 0x3C7E99DDFFFFFFDB
}
ani_heart_pulse = [
(0, pixelart['heart']),
(1, None),
(2, None),
(3, None),
(4, None),
(5, None),
(6, None),
(7, None),
(6, None),
(5, None),
(4, None),
(3, None),
(2, None),
(1, None),
(0, None),
(0, 0x00)
]
ani_pacman_pulse = [
(0, pixelart['pacman']),
(1, None),
(2, None),
(3, None),
(4, None),
(5, None),
(6, None),
(7, None),
(6, None),
(5, None),
(4, None),
(3, None),
(2, None),
(1, None),
(0, None),
(0, 0x00)
]
ani_ghost_pulse = [
(0, pixelart['ghost']),
(1, None),
(2, None),
(3, None),
(4, None),
(5, None),
(6, None),
(7, None),
(6, None),
(5, None),
(4, None),
(3, None),
(2, None),
(1, None),
(0, None),
(0, 0x00)
]
class Example:
boards = {
'd1_mini': (13, 14),
'mh_et_live_minikit': (23, 18)
}
def main(self, model):
self.matrix = mled.driver(self.boards[model][0], self.boards[model][1])
self.test()
self.animate()
def test(self):
self.matrix.clear()
self.matrix.setIntensity(7)
for y in range(0, 8):
for x in range(0, 8):
self.matrix.pixel(x, y, self.matrix.ON)
self.matrix.display()
for y in range(0, 8):
for x in range(0, 8):
self.matrix.pixel(x, y, self.matrix.OFF)
self.matrix.display()
def animate(self):
ani = mled.animation(self.matrix)
ani.loop(0, 64, ani_heart_pulse + ani_pacman_pulse + ani_ghost_pulse)
app = Example()
app.main('d1_mini')