I\'ve got a Python program which is reading data from a serial port via the PySerial module. The two conditions I need to keep in mind are: I don\'t know ho
def cmd(cmd,serial):
out='';prev='101001011'
serial.flushInput();serial.flushOutput()
serial.write(cmd+'\r');
while True:
out+= str(serial.read(1))
if prev == out: return out
prev=out
return out