DC Motor¶
This class is specifically for EV3 and NXT. This lets you drive motors that are not automatically detected as motors. This includes RCX motors and Power Function motors that are connected via the official converter cables. Note: Applying motor power to custom electronics may damage the hub or the device.
For Powered Up DC Motors, just use
the DCMotor class instead, which will
automatically detect the motor and use the correct and safe settings.
- class DCMotor(port, positive_direction=Direction.CLOCKWISE)¶
DC Motor for LEGO® MINDSTORMS EV3.
- Parameters:
- dc(duty)¶
Rotates the motor at a given duty cycle (also known as “power”).
- Parameters:
duty (Number, %) – The duty cycle (-100.0 to 100).
- brake()¶
Passively brakes the motor.
The motor stops due to friction, plus the voltage that is generated while the motor is still moving.
- stop()¶
Stops the motor and lets it spin freely.
The motor gradually stops due to friction.