Enum API.Servo

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Comparable<API.Servo>
    Enclosing class:
    API

    public static enum API.Servo
    extends java.lang.Enum<API.Servo>
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
      S0  
      S1  
      S10  
      S11  
      S2  
      S3  
      S4  
      S5  
      S6  
      S7  
      S8  
      S9  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      double getPosition()
      Gets the current position of the servo.
      void setDirection​(API.Direction direction, boolean immediate)
      Sets the direction of the servo.
      void setPosition​(double degrees)
      Sets the intended position of the servo, in degrees.
      void start​(double power)
      Starts the servo
      void stop()
      Stops the servo by setting the power to 0.
      static API.Servo valueOf​(java.lang.String name)
      Returns the enum constant of this type with the specified name.
      static API.Servo[] values()
      Returns an array containing the constants of this enum type, in the order they are declared.
      • Methods inherited from class java.lang.Enum

        compareTo, equals, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
      • Methods inherited from class java.lang.Object

        getClass, notify, notifyAll, wait, wait, wait
    • Method Detail

      • values

        public static API.Servo[] values()
        Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
        for (API.Servo c : API.Servo.values())
            System.out.println(c);
        
        Returns:
        an array containing the constants of this enum type, in the order they are declared
      • valueOf

        public static API.Servo valueOf​(java.lang.String name)
        Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
        Parameters:
        name - the name of the enum constant to be returned.
        Returns:
        the enum constant with the specified name
        Throws:
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        java.lang.NullPointerException - if the argument is null
      • setPosition

        public void setPosition​(double degrees)
        Sets the intended position of the servo, in degrees. Note that intended means it will not necessarily get to this position, but that it will constantly attempt to get there.
        Parameters:
        degrees - The intended position.
      • getPosition

        public double getPosition()
        Gets the current position of the servo. Might not match up with setPosition.
        Returns:
        The position in degrees.
      • start

        public void start​(double power)
        Starts the servo
        Parameters:
        power - The power to use, from 0 to 1
      • stop

        public void stop()
        Stops the servo by setting the power to 0.
      • setDirection

        public void setDirection​(API.Direction direction,
                                 boolean immediate)
        Sets the direction of the servo.
        Parameters:
        direction - The direction.
        immediate - Whether to start the servo upon setting direction or not.