Class SparkMax

All Implemented Interfaces:
MotorController, AutoCloseable

public class SparkMax extends SparkBase
  • Field Details

  • Constructor Details

    • SparkMax

      public SparkMax(int deviceId, SparkLowLevel.MotorType type)
      Create a new object to control a SPARK MAX motor Controller
      Parameters:
      deviceId - The device ID.
      type - The motor type connected to the controller. Brushless motor wires must be connected to their matching colors and the hall sensor must be plugged in. Brushed motors must be connected to the Red and Black terminals only.
  • Method Details

    • configure

      public REVLibError configure(SparkBaseConfig config, SparkBase.ResetMode resetMode, SparkBase.PersistMode persistMode)
      Extended Functions ******
      Overrides:
      configure in class SparkBase
      Parameters:
      config - The desired SPARK configuration
      resetMode - Whether to reset safe parameters before setting the configuration
      persistMode - Whether to persist the parameters after setting the configuration
      Returns:
      REVLibError.kOk if successful
    • getAlternateEncoder

      public RelativeEncoder getAlternateEncoder()
      Returns an object for interfacing with a quadrature encoder connected to the alternate encoder mode data port pins. These are defined as:
      • Pin 4 (Forward Limit Switch): Index
      • Pin 6 (Multi-function): Encoder A
      • Pin 8 (Reverse Limit Switch): Encoder B

      This call will disable support for the limit switch inputs.

      Returns:
      An object for interfacing with a quadrature encoder connected to the alternate encoder mode data port pins
    • getAbsoluteEncoder

      public SparkAbsoluteEncoder getAbsoluteEncoder()
      Description copied from class: SparkBase
      Returns an object for interfacing with a connected absolute encoder.
      Overrides:
      getAbsoluteEncoder in class SparkBase
      Returns:
      An object for interfacing with a connected absolute encoder
    • getForwardLimitSwitch

      public SparkLimitSwitch getForwardLimitSwitch()
      Description copied from class: SparkBase
      Returns an object for interfacing with the forward limit switch connected to the appropriate pins on the data port.
      Overrides:
      getForwardLimitSwitch in class SparkBase
      Returns:
      An object for interfacing with the forward limit switch.
    • getReverseLimitSwitch

      public SparkLimitSwitch getReverseLimitSwitch()
      Description copied from class: SparkBase
      Returns an object for interfacing with the reverse limit switch connected to the appropriate pins on the data port.
      Overrides:
      getReverseLimitSwitch in class SparkBase
      Returns:
      An object for interfacing with the reverse limit switch.