-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcolorMatrix.py
More file actions
33 lines (28 loc) · 1012 Bytes
/
Copy pathcolorMatrix.py
File metadata and controls
33 lines (28 loc) · 1012 Bytes
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
#!/usr/bin/env python
from samplebase import SampleBase
import time
class colorMatrix(SampleBase):
#init
def __init__(self, *args, **kwargs):
super(colorMatrix, self).__init__(*args, **kwargs)
#
def run(self):
#create virtual matrix
offset_canvas = self.matrix.CreateFrameCanvas()
#forever
while True:
for x in range(0, self.matrix.width):
#column, row, red, blue, green
offset_canvas.SetPixel(1, x, 255, 0, 0)
offset_canvas.SetPixel(1, x-1, 0, 0, 0)
offset_canvas = self.matrix.SwapOnVSync(offset_canvas)
offset_canvas.SetPixel(1, x, 255, 0, 0)
offset_canvas.SetPixel(1, x-1, 0, 0, 0)
offset_canvas = self.matrix.SwapOnVSync(offset_canvas)
time.sleep(.5)
# Main function
if __name__ == "__main__":
#Create colorMatrix
mat = colorMatrix()
if (not mat.process()):
print('broked')