get_motor

get_motor(channel: int, values: list[int], pwm, worker: _ChipWorker) → Motor[source]

Factory function to create and initialize a Motor instance.

Parameters:
  • channel (int) – The PWM channel number.

  • values (list[int]) – [open, close, time_open, time_close, hold] (times are the total ms to open/close; hold 1/0 is this motor’s default for keeping holding torque). Shorter legacy values are accepted.

  • pwm – The PWM chip (or NullChip) the motor is wired to.

  • worker (_ChipWorker) – The worker thread that serializes moves for whichever chip pwm belongs to (chip_box_worker/ chip_corridor_worker).

Returns:

An initialized Motor instance.

Return type:

Motor