removed ser.flush, because it fails if the arduino has not opened the serial port