Created
January 21, 2015 22:48
-
-
Save wware/a88921b3f8097fb4aa6c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
import serial | |
import sys | |
import select | |
import os | |
ser=serial.Serial('/dev/ttyUSB0',115200) | |
BUF=4096 | |
while True: | |
s=select.select([sys.stdin,ser],[],[])[0] | |
if sys.stdin in s: | |
inp=os.read(sys.stdin.fileno(),BUF) | |
ser.write(inp) | |
if ser in s: | |
inp=os.read(ser.fileno(),BUF) | |
sys.stdout.write(inp) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment