EV3 DC Motor

Note

This class is specifically for on EV3. For Powered Up DC Motors, just use the DCMotor class.

../_images/rcxmotor.png
class DCMotor(port, positive_direction=Direction.CLOCKWISE)

Generic class to control simple motors without rotation sensors, such as train motors.

Parameters
  • port (Port) – Port to which the motor is connected.

  • positive_direction (Direction) – Which direction the motor should turn when you give a positive duty cycle value.

dc(duty)

Rotates the motor at a given duty cycle (also known as “power”).

Parameters

duty (percentage: %) – The duty cycle (-100.0 to 100).

stop()

Stops the motor and lets it spin freely.

The motor gradually stops due to friction.