function res = isServoStopped(index)
%ISSERVOSTOPPED  Is a servo motor stopped?
%   isServoStopped(index) returns true if the servo motor
%   at the specified index is stopped and false otherwise.

global ADVSERVO;

if index < 0 || index > 7
    error('index must be in the range 0 to 7');
end

input = libpointer('int32Ptr', -1);
code = calllib('phidget21', 'CPhidgetAdvancedServo_getStopped', ADVSERVO, index, input);
if code == 0
    if input.Value == 0
        res = false;
    else
        res = true;
    end
else
    error(phidgetError(code));
end
