root / trunk / code / projects / calibration_platform / server / cal_sta_server.py @ 1926
History | View | Annotate | Download (266 Bytes)
1 | 1926 | jsexton | #!/usr/bin/python
|
---|---|---|---|
2 | import sys, serial |
||
3 | |||
4 | try:
|
||
5 | usb = serial.Serial(port='/dev/ttyUSB0', baudrate=19200) |
||
6 | except serial.SerialException as e: |
||
7 | print 'Error: %s' % e |
||
8 | sys.exit(0)
|
||
9 | |||
10 | print usb.inWaiting()
|
||
11 | |||
12 | while True: |
||
13 | if usb.inWaiting() > 0: |
||
14 | print usb.read()
|
||
15 | |||
16 | usb.close() |