pwm

property DCMotor.pwm: float | int

Pulse Width Modulation duty cycle of the supply voltage of the DC motor.

It must be a float or an int within -1 and 1.

In general the duty cycle can be between 0 and 1, but pwm can be between -1 and 1, in order to take into account the voltage sign with respect to the direction of rotation:

  • if pwm is positive, then the supply voltage pushes the motor to rotate in the positive direction,

  • if pwm is negative, then the supply voltage pushes the motor to rotate in the negative direction,

  • if pwm is null, then the supply voltage is null to and the motor does not develop any driving torque.

The pwm value has an impact on the driving_torque developed and the electric_current absorbed by the DC motor.

Returns

float or int

Pulse Width Modulation duty cycle of the supply voltage of the DC motor.

Raises

TypeError

If pwm is not a float or an int.

ValueError

If pwm is not within -1 and 1.