+def recvByteTO(b): #with timeout
+ j = 0
+ i = tty.read()
+ while len(i)==0 and j < 400:
+ time.sleep(0.03)
+ i = tty.read()
+ j = j + 1
+ if j == 400:
+ print "ack it!"
+ sendByte(0x23)
+ if(recvByte() != 0xaa):
+ raise Exception #ok, something really failed
+ else:
+ if(ord(i) != b):
+ raise Exception
+