adafruit / adafruit/Adafruit_CircuitPython_ServoKit

ServoKit: Add an interface to set min_pulse and max_pulse

Open
#52 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
78
Forks
31
PR merge metrics
No merged PRs in 30d

Description

The interface for objects created with ServoKit include settings for the i2c address, reference clock speed, and pulse frequency. What's missing in order to fully calibrate a servo is the ability to set the min_pulse and max_pulse parameters.
```
class ServoKit:
def __init__(
self,
*,
channels: int,
i2c: Optional[I2C] = None,
address: int = 0x40,
reference_clock_speed: int = 25000000,
frequency: int = 50
) -> None:
if channels not in [8, 16]:
raise ValueError("servo_channels must be 8 or 16!")
self._items = [None] * channels
self._channels = channels
if i2c is None:
i2c = board.I2C()
self._pca = PCA9685(
i2c, address=address, reference_clock_speed=reference_clock_speed
)
self._pca.frequency = frequency

self._servo = _Servo(self)
self._continuous_servo = _ContinuousServo(self)
```

It may be possible to get to the min_pulse and max_pulse parameters by referencing down into the Servo and adafruit_motor classes, but this isn't simple or obvious in the way it could be.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start at the ServoKit.__init__ entry point and inspect how _Servo and _ContinuousServo expose their underlying servo objects. Read the referenced Servo and adafruit_motor classes to understand the existing min_pulse and max_pulse parameters. Done means ServoKit-created objects provide a clear interface for setting both calibration values.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
embedded-iot
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.