arduino and pyserial

Waits for the Arduino to send an 'M'...

import serial

port = 'COM26'
#port = 'COM6'
baud = 1000000
timeout = 3

_serial = serial.Serial( port, baud, timeout=timeout )

_serial.flushInput()

gotsomething = False

for j in range(3):
  response = _serial.readline().decode( 'ascii' ).strip()
  if response != '':
    cracked = response.rstrip().split('\t')
    if cracked[0] == 'M':
      gotsomething = True
      break