Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import sys
- import serial
- port = raw_input("Which port? > ")
- baud = int(raw_input("What baud? > "))
- try:
- port = serial.Serial(port, baud, timeout=0)
- except SerialException:
- print "Couldn't open port, quitting."
- sys.exit(1)
- except:
- print "An error occurred, quitting."
- sys.exit(2)
- while True:
- if port.inWaiting() > 0:
- sys.stdout.write( str(ord( port.read(1) )) )
Advertisement
Add Comment
Please, Sign In to add comment