Skip to content

basic_bot.commons.servo_pca9685

Servo Objects

class Servo()

This class controls a single servo motor using the Adafruit PCA9685 servo controller. It uses a background thread to move the motor to a destination angle at a give fraction of the motor's range and thereby control the speed.

It requires the following Adafruit CircuitPython libraries to be installed:

python -m pip install adafruit-blinka adafruit-circuitpython-pca9685 adafruit-circuitpython-motorkit

__init__

def __init__(servo_options: ServoOptions) -> None

Constructor

current_angle

@property
def current_angle() -> float

Returns the current angle of the servo motor

step_delay

@property
def step_delay() -> float

Returns the current step delay

step_delay

@step_delay.setter
def step_delay(value: float) -> None

Sets the step delay

move_to

def move_to(angle: float) -> None

Move the servo to the specified angle

pause

def pause() -> None

Pause the servo movement

resume

def resume() -> None

Resume the servo movement

stop_thread

def stop_thread() -> None

Stop the servo movement thread

wait_for_motor_stopped

def wait_for_motor_stopped() -> None

Wait for the motor to stop moving