-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathwriteSign.py
More file actions
97 lines (85 loc) · 2.53 KB
/
writeSign.py
File metadata and controls
97 lines (85 loc) · 2.53 KB
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
import serial
import tweetstream
import time
#signfile = serial.Serial('/dev/ttyUSB0',baudrate=9600,stopbits=1,xonxoff=1,rtscts=0,timeout=0,parity='N',dsrdtr=0)
styles = {
"instant" : "<FB>",
"scroll_bottom" : "<FC>",
"in_place_right" : "<FD",
"from_center_h" : "<FE>",
"from_center_v" : "<FF>",
"scroll_always" : "<FH>",
"invisible" : "<FM>",
"" : "",
}
def textToSign(id, top_style, top_note, bottom_style, bottom_note, page):
signfile.write("<ID" + str(id) + ">")
signfile.write("<P"+page+">")
signfile.write(styles.get(top_style))
if bottom_note:
signfile.write("<L1>")
signfile.write(top_note)
if bottom_note:
signfile.write("<L2>")
signfile.write(styles.get(bottom_style))
signfile.write(bottom_note)
signfile.write("\r\n")
signfile.write("<ID" + str(id) + ">")
signfile.write("<RP" + page + ">")
time.sleep(1)
signfile.write("\x0C")
''' signfile.write("\x0D\x0A\x0A")
signfile.write(" <ID"+str(id)+"><PZ>")
signfile.write(styles.get(top_style))
signfile.write("<L1>")
signfile.write(top_note)
signfile.write("<L2>"+bottom_note)
signfile.write(styles.get(bottom_style))
signfile.write("\x0D\x0A")
signfile.write(" ")
signfile.write("<ID"+str(id)+"><RPZ>")
signfile.write("\x0D\x0A")
time.sleep(1)
signfile.write("\x0C")
'''
def formTweet(sign, tweet):
tosign(sign, "center", '@'+tweet['user']['screen_name'].upper(), "scroll_always", tweet['text'])
signfile = serial.Serial('/dev/ttyUSB0',baudrate=9600)
#tosign(30, "center", "", "center", "Please tweet at me!")
#tosign(40,"center", "", "center", "")
#tosign(73,"center", "", "center", "")
'''words = ["oil","dojosign","hackerdojo","hacker dojo","#dojosign"]
p = ""
pp = ""
with tweetstream.TrackStream("dojosign", "dojo77", words) as stream:
for tweet in stream:
if type(tweet['text']) is str:
print tweet['user']['screen_name']+": "+tweet['text']
print "\n"
if "oil" in tweet['text']:
formTweet(30, tweet)
if p:
formTweet(40, p)
if pp:
formTweet(73, pp)
if p:
pp = p
p = tweet
time.sleep(10)'''
'''
#signfile.write("<ID73><GY>11111111111111111111111111111111111111111111")
#signfile.write("\x0D\x0A")
signfile.write("<ID73>")
signfile.write("<V>")
#signfile.write("\r\n<ID73><RPZ>")
signfile.write("\x0D\x0A")
print signfile.readline()
time.sleep(1)
signfile.write("\x0C")
'''
textToSign(73, "", "\x7F", "", "", "A")
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()