-
-
Save anonymous/2424ba57de663fea43e5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import RPi.GPIO as GPIO | |
import time | |
from time import sleep | |
GPIO.setmode(GPIO.BCM) | |
cathodes = [11, 9, 10, 22, 27, 17] | |
anodes = [7, 8, 25, 24] | |
st = 0.001 | |
spd = 30 | |
# Letter data arrays | |
blank = [[0,0,0,0,0,0], [0,0,0,0,0,0], [0,0,0,0,0,0], [0,0,0,0,0,0]] | |
a = [[0,1,1,1,1,1], [1,0,0,1,0,0], [1,0,0,1,0,0], [0,1,1,1,1,1]] | |
b = [[1,1,1,1,1,1], [1,0,1,0,0,1], [1,1,1,0,0,1], [0,0,0,1,1,1]] | |
c = [[1,1,1,1,1,1], [1,0,0,0,0,1], [1,0,0,0,0,1], [1,1,0,0,1,1]] | |
d = [[1,1,1,1,1,1], [1,0,0,0,0,1], [1,0,0,0,0,1], [0,1,1,1,1,0]] | |
e = [[1,1,1,1,1,1], [1,0,1,1,0,1], [1,0,1,1,0,1], [1,0,1,1,0,1]] | |
f = [[1,1,1,1,1,1], [1,0,1,0,0,0], [1,0,1,0,0,0], [1,0,1,0,0,0]] | |
g = [[1,1,1,1,1,1], [1,0,0,0,0,1], [1,0,0,1,0,1], [1,1,0,1,1,1]] | |
h = [[1,1,1,1,1,1], [0,0,1,1,0,0], [0,0,1,1,0,0], [1,1,1,1,1,1]] | |
i = [[1,1,0,0,1,1], [1,1,1,1,1,1], [1,1,1,1,1,1], [1,1,0,0,1,1]] | |
j = [[1,0,0,0,1,1], [1,0,0,0,0,1], [1,1,1,1,1,1], [1,0,0,0,0,0]] | |
k = [[1,1,1,1,1,1], [0,0,1,1,0,0], [0,0,1,1,0,0], [1,1,0,0,1,1]] | |
l = [[1,1,1,1,1,1], [1,1,1,1,1,1], [0,0,0,0,1,1], [0,0,0,0,1,1]] | |
m = [[0,0,1,1,1,1], [0,0,0,1,1,0], [0,0,0,1,1,0], [0,0,1,1,1,1]] | |
n = [[0,0,1,1,1,1], [0,0,0,1,0,0], [0,0,0,0,1,0], [0,0,1,1,1,1]] | |
o = [[1,1,1,1,1,1], [1,0,0,0,0,1], [1,0,0,0,0,1], [1,1,1,1,1,1]] | |
p = [[1,1,1,1,1,1], [1,0,1,0,0,0], [1,0,1,0,0,0], [1,1,1,0,0,0]] | |
q = [[1,1,1,0,0,0], [1,0,1,0,0,0], [1,1,1,1,1,1],[0,0,0,0,0,1]] | |
r = [[1,1,1,1,1,1], [1,0,1,1,0,0], [1,0,1,1,0,0], [0,1,1,0,1,1]] | |
s = [[0,1,1,0,1,0], [1,0,1,0,0,1], [1,0,1,0,0,1], [0,1,0,1,1,0]] | |
t = [[1,1,0,0,0,0], [1,1,1,1,1,1], [1,1,1,1,1,1], [1,1,0,0,0,0]] | |
u = [[1,1,1,1,1,1], [0,0,0,0,0,1], [0,0,0,0,0,1], [1,1,1,1,1,1]] | |
v = [[0,1,1,1,1,0], [0,0,0,0,0,1], [0,0,0,0,0,1], [0,1,1,1,1,0]] | |
w = [[0,0,0,1,1,1], [0,0,0,0,1,1], [0,0,0,0,1,1], [0,0,0,1,1,1]] | |
x = [[0,0,1,0,0,1], [0,0,0,1,1,0], [0,0,0,1,1,0], [0,0,1,0,0,1]] | |
y = [[1,1,0,0,0,0], [0,0,1,1,1,1], [0,0,1,1,1,1], [1,1,0,0,0,0]] | |
z = [[0,0,1,0,0,1], [0,0,1,0,1,1], [0,0,1,1,0,1], [0,0,1,0,0,1]] | |
flash = [[1,1,1,1,1,1], [1,1,1,1,1,1], [1,1,1,1,1,1], [1,1,1,1,1,1]] | |
exclamation = [[0,0,0,0,0,0], [1,1,1,0,1,1], [1,1,1,0,1,1], [0,0,0,0,0,0]] | |
## Scrolling dots | |
cha = [[1,0,0,0,0,0], [0,0,0,0,0,0], [0,0,0,0,0,0],[0,0,0,0,0,0]] | |
chb = [[0,1,0,0,0,0], [1,0,0,0,0,0], [0,0,0,0,0,0], [0,0,0,0,0,0]] | |
chc = [[1,0,1,0,0,0], [0,1,0,0,0,0], [1,0,0,0,0,0], [0,0,0,0,0,0]] | |
chd = [[0,1,0,1,0,0], [1,0,1,0,0,0], [0,1,0,0,0,0], [1,0,0,0,0,0]] | |
che = [[1,0,1,0,1,0], [0,1,0,1,0,0], [1,0,1,0,0,0], [0,1,0,0,0,0]] | |
chf = [[0,1,0,1,0,1], [1,0,1,0,1,0], [0,1,0,1,0,0], [1,0,1,0,0,0]] | |
chg = [[1,0,1,0,1,0], [0,1,0,1,0,1], [1,0,1,0,1,0], [0,1,0,1,0,0]] | |
chh = [[0,1,0,1,0,1], [1,0,1,0,1,0], [0,1,0,1,0,1], [1,0,1,0,1,0]] | |
chi = [[1,0,1,0,1,0], [0,1,0,1,0,1], [1,0,1,0,1,0], [0,1,0,1,0,1]] | |
chj = [[0,1,0,1,0,1], [1,0,1,0,1,0], [0,1,0,1,0,1], [1,0,1,0,1,0]] | |
chk = [[1,0,1,0,1,0], [0,1,0,1,0,1], [1,0,1,0,1,0], [0,1,0,1,0,1]] | |
chl = [[0,1,0,1,0,1], [1,0,1,0,1,0], [0,1,0,1,0,1], [1,0,1,0,1,0]] | |
chm = [[1,0,1,0,1,0], [0,1,0,1,0,1], [1,0,1,0,1,0], [0,1,0,1,0,1]] | |
chn = [[0,1,0,1,0,1], [1,0,1,0,1,0], [0,1,0,1,0,1], [1,0,1,0,1,0]] | |
cho = [[0,0,1,0,1,0], [0,1,0,1,0,1], [1,0,1,0,1,0], [0,1,0,1,0,1]] | |
chp = [[0,0,0,1,0,1], [0,0,1,0,1,0], [0,1,0,1,0,1], [1,0,1,0,1,0]] | |
chq = [[0,0,0,0,1,0], [0,0,0,1,0,1], [0,0,1,0,1,0], [0,1,0,1,0,1]] | |
chv = [[0,0,0,0,0,1], [0,0,0,0,1,0], [0,0,0,1,0,1],[0,0,1,0,1,0]] | |
chs = [[0,0,0,0,0,0], [0,0,0,0,0,1], [0,0,0,0,1,0], [0,0,0,1,0,1]] | |
cht = [[0,0,0,0,0,0], [0,0,0,0,0,0], [0,0,0,0,0,1], [0,0,0,0,1,0]] | |
chu = [[0,0,0,0,0,0], [0,0,0,0,0,0], [0,0,0,0,0,0], [0,0,0,0,0,0]] | |
cyc = [ cha, chb, chc, chd, che, chf, chg, chh, chi, chj, chk, chl, chm, chn, cho, chp, chq, chv, chs, cht, chu ]#scrolling dots 22 | |
#cyc = [ r, blank, a, blank, s, blank, p, blank, b, blank, e, blank, r, blank, r, blank, y, blank, blank, p, blank, i ] | |
#data = input() | |
#cyc = data | |
rng = len(cyc) | |
for cathode in cathodes: | |
GPIO.setup(cathode, GPIO.OUT) | |
GPIO.output(cathode, 0) | |
for anode in anodes: | |
GPIO.setup(anode, GPIO.OUT) | |
GPIO.output(anode, 0) | |
try: | |
while True: | |
for frame in range(rng): | |
for pause in range(spd): | |
for i in range(4): | |
GPIO.output(cathodes[0],cyc[frame][i][0]) | |
GPIO.output(cathodes[1],cyc[frame][i][1]) | |
GPIO.output(cathodes[2],cyc[frame][i][2]) | |
GPIO.output(cathodes[3],cyc[frame][i][3]) | |
GPIO.output(cathodes[4],cyc[frame][i][4]) | |
GPIO.output(cathodes[5],cyc[frame][i][5]) | |
GPIO.output(anodes[i],1) | |
sleep(st) | |
GPIO.output(anodes[i],0) | |
except KeyboardInterrupt: | |
# print data | |
GPIO.cleanup() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment