function [posArray,t] = readAllPtP2(H,return1,return2,return3)

globalVar;
posArray = zeros(3,800);
t = zeros(3,800);

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

[command,return1,return2,return3] = readServo(H);       % Não preciso desta
N = (return1*256) + return2;                            % leitura porque
disp(['Movement with ', num2str(N), ' values.']);       % N = i-1;
% disp(['Movement with ', num2str(i-1), ' values.']);

for i=1:N
    for j=1:3
        posArray(j,i) = (((posArray(j,i)-VAL_ANGLE_MIN)*ANGLE_RANGE)/VAL_ANGLE_RANGE)+ANGLE_MIN;
        if(j==3)
            posArray(j,i)=(-posArray(j,i)-90)/(30/22);
        end
        if(j==1)
            posArray(j,i)=-posArray(j,i)/4;
        end
        if(j==2)
            posArray(j,i)=posArray(j,i)/4;
        end
    end
end

posArray = posArray(:,1:N);
t = t(:,1:N);

end