public synchronized void sendCommand(int portNo, int p) {
		log(portNo, p);
		String command = "#" + portNo + "P" + p + "\r";
		try {
			if (isRecording) {
				serialPort.writeBytes(command.getBytes());
				recordCommand(command);
				long current = System.currentTimeMillis() % 1000;
				command = Long.toString(current - time);
				//recordCommand(command);
				time = current;
			} else if (!isPlaybacking){			
					serialPort.writeBytes(command.getBytes());				
			}
		} catch (SerialPortException e) {
			logger.error(e);
		}
	}