function saveResults(H,posArray,valSensor)

globalVar;
N=200;    
nMoves=0;

sendServo(H,25,0,0,0,0,0,0);
for i=1:N
    for j=1:3
        [command,return1,return2,return3]=readServo(H);
        posArray(j,i)=return1*256+return2;
    end
end
for i=1:N
    [command,return1,return2,return3]=readServo(H);
    t(1,i)=return1*256+return2;
end

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

nMoves=nMoves+1;
if(nMoves==6)
    nMoves=1;
end

for i=(nMoves*N-N+1):nMoves*N
    test.posArray(:,i)=posArray(:,i-((nMoves-1)*N));                  
    test.time(1,i)=t(1,i-((nMoves-1)*N));
    test.valSensor(i,:)=valSensor(i-((nMoves-1)*N),:);
end

save .\Video\moving test

end