Permalink
Switch branches/tags
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
58 lines (44 sloc) 1.18 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>" + v + "<" + '13' + ">" + "is " + v \
+ c['end'] + ' ' + c['id'] + '<RPZ>' + c['end']
def nextline():
while True:
x = ""
for z in range(13, 256):
yield chr(int(z))
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)
tosign(outs(v))
time.sleep(112)
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()