Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
61 lines (47 sloc) 1.27 KB
import serial
#import tweetstream
import time
import random
#signfile = serial.Serial('/dev/ttyUSB0',baudrate=9600,stopbits=1,xonxoff=1,rtscts=0,timeout=0,parity='N',dsrdtr=0)
signs = "30", "40", "73"
my_sign = signs[1]
styles = {
"scroll_stuck" : "<FM>",
"center" : "<FB>",
"scroll_always" : "<FH>",
}
code = { "start" : "\x0D\x0A\x0A",
"id" : "<ID" + my_sign+ ">",
"center" : "<FB>",
"top" : "<L1>",
"scroll_always" : "<FH>",
"scroll_stuck" : "<FM>",
"end" : "\x0D\x0A"
}
c = code
def outs(v):
return c['start'] + ' ' + c['id'] + "<PZ>" + '<FB>' + '<R' + v + '' + "is " + v \
+ c['end'] + ' ' + c['id'] + '<RPZ>' + c['end']
def nextline():
while True:
x = ""
for z in range(0, 64):
x = x + chr(z) + chr(z) + chr(z)
if len(x) >= 3:
yield x
x = ""
yield x
def tosign(s) :
signfile.write(s)
time.sleep(1)
signfile.write("\x0C")
signfile = serial.Serial('/dev/ttyUSB0',baudrate=9600)
for v in nextline():
print "V = ", v, ord(v[0])
tosign(outs(v))
time.sleep(5)
signfile.close()
#signfile.write("\n\n<ID40><PZ><FB><L1>BBB<FP5><L2>AAA<FH>\n")
#signfile.write("<ID40><RPZ>")
#signfile.write("\x0C")
#signfile.close()