Motor Controller 55#

Introduction#

The Motor Controller 55 (MC55) is used to control standard DC motors.

The VEX Motor Controller 55.

This page uses mc_55 as the example Motor Controller 55 name. Replace it with your own configured name as needed.

Below is a list of available methods:

  • spin – Spins a DC motor forward or reverse until stopped.

  • stop – Stops the DC motor immediately.

  • set_velocity – Sets the DC motor’s spin speed as a percentage.

  • set_stopping – Sets how the DC motor behaves when stopping.

  • set_max_torque – Limits the maximum torque the DC motor can apply.

  • set_reversed – Sets the DC motor to have its direction be reversed.

  • current – Returns the current drawn by the DC motor.

  • temperature – Returns the current temperature of the DC motor.

Constructor – Manually initialize a Motor Controller 55.

  • Motor55 – Creates a Motor Controller 55.

spin#

spin rotates a connected DC motor in a specified direction using the current motor velocity.

Usage: mc_55.spin(direction, velocity, units)

Parameters

Description

direction

The direction in which to spin the motor:

  • FORWARD – By default, this is counterclockwise
  • REVERSE – By default, this is clockwise

velocity

Optional. The velocity at which the motor will spin as a float or integer. If the velocity is not specified or previously set, the default velocity is 50%.

If VOLT is used in units, this will accept a range from -12.0 to 12.0 where a negative value will spin opposite to the given direction.

units

Optional. The unit that represents the velocity:

  • PERCENT
  • RPM – Rotations per minute
  • VelocityUnits.DPS – Degrees per second
  • VOLT (default) – Will spin the motor or motor group at a specified voltage.

# Spin the motor at -2 volts
mc_55.spin(FORWARD, -2)

stop#

stop stops the connected DC motor immediately, using the current stopping mode.

Usage:
mc_55.stop(mode)

Parameter

Description

mode

Optional. The stopping behavior to use when the motor stops:

  • BRAKE – Stops immediately.
  • COAST – Slows gradually to a stop.

If the stopping mode is not specified or previously set, the default behavior is BRAKE.

set_velocity#

set_velocity sets the default spinning speed of a DC motor as a percent for all subsequent Motor Controller 55 methods in the project.

Usage:
mc_55.set_velocity(value, units)

Parameter

Description

value

The velocity to set for the DC Motor from 0 to 100.

units

Optional. The unit that represents the velocity:

  • PERCENT

set_stopping#

set_stopping sets how a DC motor behaves when it stops.

Usage:
mc_55.set_stopping(mode)

Parameters

Description

mode

How the motor will stop:

  • BRAKE – Stops immediately.
  • COAST – Slows gradually to a stop.

set_max_torque#

set_max_torque sets how much force a DC motor can exert.

Usage:
mc_55.set_max_torque(value, units)

Parameters

Description

value

The new maximum torque for a motor as a float or integer.

units

Optional. The unit that represents the torque:

  • CurrentUnits.AMP (default)

set_reversed#

set_reversed sets the DC motor to be reversed so that the FORWARD direction will spin clockwise. This method works the same as setting the reverse parameter to True when constructing a Motor55.

Usage:
mc_55.set_reversed(value)

Parameters

Description

value

Boolean value to set the direction reversed or not:

  • True – Reverse the motor’s direction
  • False – Return the motor’s direction to its default

current#

current returns the amount of electrical current the DC Motor in a range from 0.0 to 1.2 amps (amperes).

Usage:
mc_55.current(units)

Parameters

Description

units

Optional. The unit that represents the current:

  • CurrentUnits.AMP (default) – Amps

temperature#

temperature returns the current temperature of the DC Motor.

Usage:
mc_55.temperature(units)

Parameters

Description

units

Optional. The units that represent the temperature:

  • TemperatureUnits.CELSIUS (default)
  • TemperatureUnits.FAHRENHEIT
  • PERCENT

Constructors#

Constructors are used to manually create Motor55 objects, which are necessary for configuring a Motor Controller 55 outside of VEXcode.

Motor55#

Motor55 creates a Motor Controller 55.

Usage:
Motor55(port, gears, reverse)

Parameter

Description

port

The 3-Wire Port that the V5 Pneumatic Solenoid is connected to:

  • On the V5 BrainPorts.PORTx where x is the number of the port.
  • On a 3-Wire Expanderexpander.a where expander is the name of the expander instance.

reverse

Optional. Sets whether the motor’s spin should be reversed.

  • TrueFORWARD will spin clockwise
  • False (default) – FORWARD will spin counterclockwise

# Create a Motor Controller 55 in Port A
mc_55 = Motor55(brain.three_wire_port.a)