import time
import serial
ser = serial.Serial(
port='/dev/ttyUSB1',
baudrate=9600,
parity=serial.PARITY_ODD,
stopbits=serial.STOPBITS_TWO,
bytesize=serial.SEVENBITS
)
ser.isOpen()
print 'Enter your commands below.
Insert "exit" to leave the application.'
input=1
while 1 :
input = raw_input(">> ")
if input == 'exit':
ser.close()
exit()
else:
carriage return and line feed to the characters - this is requested by my device)
ser.write(input + '
')
out = ''
time.sleep(1)
while ser.inWaiting() > 0:
out += ser.read(1)
if out != '':
print ">>" + out