j5.components.motor module

Classes for Motor support.

class j5.components.motor.Motor(identifier: int, backend: j5.components.motor.MotorInterface)[source]

Bases: j5.components.component.Component

Brushed DC motor output.

identifier

An integer to identify the component on a board.

Returns:component identifier.
static interface_class() → Type[j5.components.component.Interface][source]

Get the interface class that is required to use this component.

Returns:interface class.
power

Get the current power of this output.

Returns:current power of this output.
class j5.components.motor.MotorInterface[source]

Bases: j5.components.component.Interface

An interface containing the methods required to control a motor board.

get_motor_state(identifier: int) → Union[float, j5.components.motor.MotorSpecialState][source]

Get the current motor state.

Parameters:identifier – identifier of the motor
Returns:state of the motor.
set_motor_state(identifier: int, power: Union[float, j5.components.motor.MotorSpecialState]) → None[source]

Set the state of a motor.

Parameters:
  • identifier – identifier of the motor
  • power – state of the motor.
class j5.components.motor.MotorSpecialState[source]

Bases: enum.Enum

An enum of the special states that a motor can be set to.

BRAKE = 1
COAST = 0