Class MServo

    • Constructor Detail

      • MServo

        public MServo​(I2CPort port,
                      int location)
        The initial Constructor. This constructor establish where is plugged NXTServo on NXT Brick, where the RC Servo is plugged into NXTServo
        Parameters:
        port -
        location -
      • MServo

        public MServo​(I2CPort port,
                      int location,
                      java.lang.String servoName)
        The initial Constructor. This constructor establish where is plugged NXTServo on NXT Brick, where the RC Servo is plugged into NXTServo
        Parameters:
        port -
        location -
        servoName -
      • MServo

        public MServo​(I2CPort port,
                      int location,
                      java.lang.String servoName,
                      int min_angle,
                      int max_angle)
        Constructor with the feature to set min, max and init angle
        Parameters:
        port -
        location -
        servoName -
        min_angle -
        max_angle -
    • Method Detail

      • setPulse

        public void setPulse​(int pulse)
        This method set the pulse in a RC Servo. Note:Pulse range is: 500-2500, but internally it is necessary to divide into 2
        Parameters:
        pulse - the pulse width
      • getPulse

        public int getPulse()
        Return the pulse used in last operation
        Returns:
        the pulse
      • setAngle

        public void setAngle​(int angle)
        Method to set an Angle in a RC Servo.
        Parameters:
        angle - the angle
      • getAngle

        public int getAngle()
        Return the angle used in last operation
        Returns:
        the angle
      • setSpeed

        public void setSpeed​(int speed)
        Method to set the Speed in a RC Servo.
        Parameters:
        speed - the speed