-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsimpleProgress.py
More file actions
36 lines (25 loc) · 790 Bytes
/
simpleProgress.py
File metadata and controls
36 lines (25 loc) · 790 Bytes
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
'''
Created on Jan 5, 2012
@author: wwward
'''
import serial, sys
class display:
def __init__(self, usb='/dev/ttyUSB0', baud=9600, debug=True):
try:
self.comm = serial.Serial(usb, baud)
if debug: print "serial init" + usb + baud
except serial.SerialException:
sys.exit("error initializing port")
self.comm.setRTS(0)
def clear(self):
self.comm.write(chr(0xFE)+chr(0x01))
def write(self,string):
self.comm.write(string)
def close(self):
print "Terminating: Closing serial port."
self.comm.close()
if __name__ == '__main__':
d = display(sys.argv[1],sys.argv[2])
d.clear()
d.write('foo')
sys.exit(0)