CANSparkMax

class rev.CANSparkMax(deviceID: int, type: rev._rev.CANSparkLowLevel.MotorType)

Bases: CANSparkBase

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.

getAlternateEncoder(*args, **kwargs)

Overloaded function.

  1. getAlternateEncoder(self: rev._rev.CANSparkMax, countsPerRev: int) -> rev._rev.SparkMaxAlternateEncoder

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.

  1. getAlternateEncoder(self: rev._rev.CANSparkMax, encoderType: rev._rev.SparkMaxAlternateEncoder.Type, countsPerRev: int) -> rev._rev.SparkMaxAlternateEncoder

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.

getEncoder() rev._rev.SparkRelativeEncoder

Returns an object for interfacing with the encoder connected to the encoder pins or front port of the SPARK MAX.

For a SPARK MAX in brushless mode, it is assumed that the default encoder type is hall effect and the counts per revolution is 42.