function [ x,y,z,drawPress,mode ] = getNewCommunication( result,s )
% Read a new packet from serial and extract the necessary fields

    if (result==0)   % don't vibrate
        fprintf(s,'s');
    else   % vibrate
        fprintf(s,'t');
    end
    pack = fscanf(s,'%s')

%     Extract x,y,z in triangular coordinate system from spools 
    xInd=strfind(pack,'x');
    yInd=strfind(pack,'y');
    zInd=strfind(pack,'z');
    drawInd=strfind(pack,'d');
    modeInd = strfind(pack,'m');
    
    % convert x-y-z to integers
    x=str2num(pack(1:xInd-1));
    y=str2num(pack(xInd+1:yInd-1));
    z=str2num(pack(yInd+1:zInd-1)); 
    drawPress=str2num(pack(zInd+1:drawInd-1)); 
    mode = str2num(pack(drawInd+1:modeInd-1));

end

