function [N,posArray,t,XYZiL,XYZfL] = Seq_ContMov(H,seq)

globalVar;

XYZ = zeros(3);

if (seq(4) == 1)
    disp(' Lefth Arm will be Used');
    disp(' ** Lefth Arm - XYZ **');
    for i = 1:3
        XYZ(1,i) = seq(i);
    end
    disp(['XYZ_f_L: ', num2str(XYZ(1,:))]);
    XYZ(1,:) = XYZ(1,:)+400;
    
    XYZ(3,1) = seq(9);
    disp(['TxL: ', num2str(XYZ(3,1))]);
    XYZ(3,1) = XYZ(3,1)*100;
end

if (seq(8) == 1)
    disp(' Rigth Arm will be Used');
    disp(' ** Rigth Arm - XYZ **');
    for i = 1:3
        XYZ(2,i) = seq(i+4);
    end
    disp(['XYZ_f_R: ', num2str(XYZ(2,:))]);
    XYZ(2,:) = XYZ(2,:)+400;
    
    XYZ(3,2) = seq(10);
    disp(['TxR: ', num2str(XYZ(3,2))]);
    XYZ(3,2) = XYZ(3,2)*100;
end

XYZ(3,3) = seq(11);
disp(['Tipe os Order: ', num2str(XYZ(3,3))]);

Tramas = 3;
for i = 1:Tramas
    param1 = bitand(XYZ(i,1),MASK_HIGH) / 256;
    param2 = bitand(XYZ(i,1),MASK_LOW);
    param3 = bitand(XYZ(i,2),MASK_HIGH) / 256;
    param4 = bitand(XYZ(i,2),MASK_LOW);
    param5 = bitand(XYZ(i,3),MASK_HIGH) / 256;
    param6 = bitand(XYZ(i,3),MASK_LOW);
    sendServo(H,Tramas,17,param1,param2,param3,param4,param5,param6);
end


[command,return1,return2,return3] = readServo(H);
XYZiL(1) = return1*256 + return2;
temp_ret = return3;
[command,return1,return2,return3] = readServo(H);
XYZiL(2) = temp_ret*256 + return1;
XYZiL(3) = return2*256 + return3;
XYZiL = XYZiL-400;
XYZfL = XYZ(1,:)-400;

i=0;
while (return1 ~= 1 || return2 ~= 2 || return3 ~= 3)
    i = i+1;
    [command,return1,return2,return3] = readServo(H);
    posArray(1,i) = return1*256 + return2;
    temp_ret = return3;
    [command,return1,return2,return3] = readServo(H);
    posArray(2,i) = temp_ret*256 + return1;
    posArray(3,i) = return2*256 + return3;

    [command,return1,return2,return3] = readServo(H);
    t(1,i) = return1*256+return2;
end

disp(' ');
disp(' ** RESULTS **');
a= [XYZ(3,1) XYZ(3,2)];
pause(max(a)/100);
[command,return1,return2,return3] = readServo(H);
if(command ~= 17)
    disp('OPERATION FAILED: Testing Inverse Kinetic');
end
disp('Lefth Arm :');
switch (return1)
    case 0
        disp('  OUT of Limits');
    case 1
        disp('  Inverse Kinetic is Working');
    case 2
        disp('  ERRO: OUT1 of WorkVolume');
    case 3
        disp('  ERRO: OUT2 of WorkVolume');
    case 4
        disp('  ERRO: OUT3 of WorkVolume');
    case 5
        disp('  ERRO: OUT4 of WorkVolume');
    case 6
        disp('  Not Used');
end
% disp('Rigth Arm :');
% switch (return2)
%     case 0
%         disp('  OUT of Limits');
%     case 1
%         disp('  Inverse Kinetic is Working');
%     case 2
%         disp('  ERRO: OUT1 of WorkVolume');
%     case 3
%         disp('  ERRO: OUT2 of WorkVolume');
%     case 4
%         disp('  ERRO: OUT3 of WorkVolume');
%     case 5
%         disp('  ERRO: OUT4 of WorkVolume');
%     case 6
%         disp('  Not Used');
% end

k = return2;
N = return3;
disp(['Movement with ', num2str(N), ' values.']);
disp(['Movement with ', num2str(k), ' invalid InvKin.']);
time = t(1,N)/1000;
disp(['Time from PIC: ', num2str(time), ' s']);

for j=1:3;
    for i=1:N
        posArray(j,i) = (((posArray(j,i)-VAL_ANGLE_MIN)*ANGLE_RANGE)/VAL_ANGLE_RANGE)+ANGLE_MIN;
    end
end
posArray = posArray(:,1:N);
t = t(1,1:N);

disp('---------------------------------------');

end