public TwoWaySerialComm(String[] args, IOMonitor angle, IOMonitor pos,
			IOMonitor signal, String serialPort, int baudRate, int bufferSize) {
		this.monitor = signal;

		for (int i = 0; i < args.length; i++) {
			switch (i) {
			case 0:
				try {
					baudRate = Integer.parseInt(args[0]);
					System.out.println("[ARGUMENT] baud rate: " + baudRate);
				} catch (NumberFormatException e) {
					System.out
							.println("[ERROR] Baud rate must be an integer. Was: '"
									+ args[1] + "'");
					System.out.println("[SYSTEM EXIT]");
					System.exit(0);
				}
				break;
			case 1:
				try {
					bufferSize = Integer.parseInt(args[1]);
					System.out.println("[ARGUMENT] buffer size: " + bufferSize);
				} catch (NumberFormatException e) {
					System.out
							.println("[ERROR] Buffer size must be an integer. Was: '"
									+ args[2] + "'");
					System.out.println("[SYSTEM EXIT]");
					System.exit(0);
				}
				break;
			case 2:
				serialPort = args[2];
				System.out.println("[ARGUMENT] port: " + serialPort);
				break;

			}
		}

		System.out.println("[USING] port:        " + serialPort);
		System.out.println("[USING] baud rate:   " + baudRate);
		System.out.println("[USING] buffer size: " + bufferSize);

		System.setProperty("gnu.io.rxtx.SerialPorts", serialPort);
		this.serialPort = serialPort;
		this.baudRate = baudRate;
		this.bufferSize = bufferSize;
	}