-
Notifications
You must be signed in to change notification settings - Fork 0
/
Screen.py
42 lines (32 loc) · 1.31 KB
/
Screen.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
# -----------------------------------------------------------------------------
# Screen
# -----------------------------------------------------------------------------
from sense_hat import SenseHat
class Screen:
sense = None
buffer = []
bufferEmpty = [
[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0],
[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0],
[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0],
[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0],
[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0],
[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0],
[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0],
[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0]
]
def __init__(self):
self.sense = SenseHat()
self.sense.low_light = True
def set (self, buffer):
self.buffer = buffer
def clear(self):
self.buffer = list(self.bufferEmpty)
def off (self):
self.sense.clear()
def set_pixel (self, x, y, color):
x = int(round((x)))
y = int(round((y)))
self.buffer[(((y-1)*8) + (x-1))] = color
def draw (self):
self.sense.set_pixels(self.buffer)