return wait_for_com_Port_to_appear(OriginalPorts, ComPort);
}
}
// connect to the serial port
Serial serialPort;
try {
serialPort = new Serial(ComPort, 9600);
} catch (Exception e) {
e.printStackTrace();
Common.log(new Status(IStatus.WARNING, ArduinoConst.CORE_PLUGIN_ID, "Unable to open Serial port " + ComPort, e));
return ComPort;
// throw new RunnerException(e.getMessage());
}
if (!serialPort.IsConnected()) {
Common.log(new Status(IStatus.WARNING, ArduinoConst.CORE_PLUGIN_ID, "Unable to open Serial port " + ComPort, null));
return ComPort;
}
if (!bDisableFlushing) {
// Cleanup the serial buffer
flushSerialBuffer(serialPort);// I wonder is this code on the right
// place (I mean before the reset?;
// shouldn't it be after?)
}
// reset arduino
ToggleDTR(serialPort, 100);
serialPort.dispose();
return ComPort;
}