-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPiZeroPOV.py
68 lines (57 loc) · 2.97 KB
/
PiZeroPOV.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
import RPi.GPIO as GPIO
import time
GPIO.setmode(GPIO.BOARD)
chan_list = [11,12,13,15,16,18,22,7]
A = [[0,1,1,1,1,1,1,1],[1,0,0,1,1,0,0,0],[0,1,1,1,1,1,1,1],[0,0,0,0,0,0,0,0]]
B = [[1,1,1,1,1,1,1,1],[1,0,0,1,1,0,0,1],[0,1,1,0,1,1,1,0],[0,0,0,0,0,0,0,0]]
C = [[1,1,1,1,1,1,1,1],[1,0,0,0,0,0,0,1],[1,0,0,0,0,0,0,1],[0,0,0,0,0,0,0,0]]
D = [[1,1,1,1,1,1,1,1],[0,1,0,0,0,0,0,1],[0,0,1,1,1,1,1,1],[0,0,0,0,0,0,0,0]]
E = [[1,1,1,1,1,1,1,1],[1,0,0,1,1,0,0,1],[1,0,0,0,0,0,0,1],[0,0,0,0,0,0,0,0]]
F = [[1,1,1,1,1,1,1,1],[1,0,0,1,1,0,0,0],[1,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0]]
G = [[1,1,1,1,1,1,1,1],[1,0,0,0,1,1,0,1],[1,0,0,0,1,1,1,1],[0,0,0,0,0,0,0,0]]
H = [[1,1,1,1,1,1,1,1],[0,0,0,1,1,0,0,0],[1,1,1,1,1,1,1,1],[0,0,0,0,0,0,0,0]]
I = [[0,0,0,0,0,0,0,0],[1,1,1,1,1,1,1,1],[0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0]]
J = [[0,0,0,0,0,0,1,1],[0,0,0,0,0,0,0,1],[1,1,1,1,1,1,1,1],[0,0,0,0,0,0,0,0]]
K = [[1,1,1,1,1,1,1,1],[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0,0,0,1,1,1,1,1],[1,1,1,0,0,0,0,0],[0,0,0,0,0,0,0,0]]
Z = [[1,1,1,1,1,1,1,1],[0,0,0,0,0,0,0,1],[0,0,0,0,0,0,0,1],[0,0,0,0,0,0,0,0]]
Space = [[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]]
alphabet = {'a': A,'b': B,'c': C,'d': D,'e': E,'f': F,'g': G,'h': H,'i': I,'j': J,'k': K,'l': L,'m': M,'n': N,'o': O,'p': P,'q': Q,'r': R,'s': S,'t': T,'u': U,'v': V,'w': W,'x': X,'y': Y,'z': Z,' ': Space}
t0 = time.time()
povText = ""
def displayChar(character):
for row in range(0, len(character)):
for col in range(0, len(character[row])):
GPIO.output(chan_list[col], character[row][col])
time.sleep(0.002)
def printPov(text):
for char in text:
displayChar(alphabet[char])
def readTextFile():
with open('pov.txt', 'r') as myfile:
data=myfile.read().replace('\n', '')
return data
GPIO.setup(chan_list, GPIO.OUT)
try:
povText = readTextFile()
while (1):
printPov(povText)
if (int(time.time() - t0)%10) == 0:
povText = readTextFile()
except KeyboardInterrupt:
print
finally:
GPIO.cleanup()