Motor

class arduino.motor.Stepper(board: pyfirmata.pyfirmata.Board, spr: int)

Base stepper motor class. Extend from this to create a specific motor.

clock: arduino.core.Clock

Motor’s clock. Set at init so no overhead for creating the object.

property pos: float

The current position in degrees.

rotate(deg: float, rpm: float)

Rotate the motor.

Parameters
  • deg – The angle to rotate in degrees.

  • rpm – Speed in revolutions per minute.

rotate_for(deg: float, t: float)

Rotate deg for t seconds.

rotate_to(deg: float, rpm: float)

Rotate to deg at rpm rotations per minute.

rotate_to_for(deg: float, t: float)

Rotate to deg for t seconds.

spr: int

Steps per revolution.

step(cw: bool, t: float)

Step the motor. Calls self._step(cw, t). Define in a subclass.

Parameters
  • cw – True if clockwise, False if counter-clockwise.

  • t – Total step time.