CANSparkFlex

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

Bases: CANSparkBase

Create a new object to control a SPARK Flex 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.

getEncoder() rev._rev.SparkRelativeEncoder

Returns an object for interfacing with the encoder connected through the the motor interface of the SPARK Flex.

For a SPARK Flex in brushless mode, it is assumed that the default encoder type is quadrature and the counts per revolution is 7168.

getExternalEncoder(*args, **kwargs)

Overloaded function.

  1. getExternalEncoder(self: rev._rev.CANSparkFlex, countsPerRev: int) -> rev._rev.SparkFlexExternalEncoder

Returns an object for interfacing with an external quadrature encoder

  1. getExternalEncoder(self: rev._rev.CANSparkFlex, encoderType: rev._rev.SparkFlexExternalEncoder.Type, countsPerRev: int) -> rev._rev.SparkFlexExternalEncoder

Returns an object for interfacing with an external quadrature encoder