AForge.Robotics.TeRK.Qwerk.Servos.SetPosition C# (CSharp) Метод

SetPosition() публичный Метод

Set position of a single servo.

The method sets position of single Qwerk's servo, which index is specified. It is preferred to use SetPositions for setting positions of multiple servos, which does it at once.

Invalid servo is specified. No connection to Qwerk or its service. Connestion to Qwerk is lost.
public SetPosition ( int servo, int position ) : int
servo int Servo to set position for, [0, ).
position int Position to set for the specified servo, [0, 255].
Результат int
            public int SetPosition( int servo, int position )
            {
                if ( ( servo < 0 ) || ( servo >= Count ) )
                {
                    throw new ArgumentOutOfRangeException( "Invalid servo is specified." );
                }

                bool[] mask = new bool[Count];
                int[] positions = new int[Count];

                mask[servo] = true;
                positions[servo] = position;

                return SetPositions( mask, positions )[servo];
            }