
public class SerialCommands {
	public static void sendDeltas(SerialCom serialCom, int deltaLeft, int deltaRight) {
		byte dataL1 = (byte) ((deltaLeft & 0xFF00) >> 8);
		if(deltaLeft < 0)
			dataL1 &= 0x7F;
		else
			dataL1 |= 0x80;
		byte dataL2 = (byte) (deltaLeft & 0xFF);

		byte dataR1 = (byte) ((deltaRight & 0xFF00) >> 8);
		if(deltaRight < 0)
			dataR1 &= 0x7F;
		else
			dataR1 |= 0x80;
		byte dataR2 = (byte) (deltaRight & 0xFF);

		byte[] data = new byte[] {dataL1, dataL2, dataR1, dataR2};
		serialCom.send(data);
		
		// wait for a response = move complete
		byte[] bytes = null;
		while(bytes == null
				|| bytes.length <= 0) {
			bytes = serialCom.recieve();
		}
	}
}
