Skip to main content

This is an automatic translation, may be incorrect in some places.

Smooth Servo Library

This library is a collection of deceleration options for my servo libraries. Since this functionality is not mandatory, I decided to move it to a separate library.

Library features:

  • Allows you to create iterators based on: value, time, regrettable slowdown.

Materials used to create the library:

Compatibility

  • MicroPython 1.19.1
  • Raspberry Pi Pico

On the hardware above the library has been tested and works correctly.

ATTENTION

You use this module at your own risk. I am new to MicroPython programming. So there may be nuances that I did not take into account. If you notice an error or have suggestions for improvement, please write to Issues.

Contents

Installation

  • Install the library via pip (Thonny -> Manage Packages) by name smooth-servo
  • Or manual installation:
    • Download library from GitHub
    • take the smooth_servo folder from the archive.
    • upload to the root of the microcontroller or to the lib folder.

Usage

This library is primarily designed to be used with my servo libraries. But you can also use it in other projects like this:

from smooth_servo import SmoothLinear

# Set parameters
value = 100  # End value the iterator should reach
time_ms = 1000  # Time in milliseconds to reach end value
start_value = 0  # Start value
tick_time_ms = 50  # Time between iterations (used to calculate the number of steps)

# Create an instance of the iterator class
linear = SmoothLinear(value, time_ms, start_value)

# create an iterator with a given time between iterations
iterator = linear.generate(tick_time_ms)

# Use an iterator
for i in iterator:
    print(i)

Documentation

Constructor parameters

Parameter type default description
value int None End value
time_ms int None The time in milliseconds it takes to reach the final value
start_value int 0 Initial value
  • value - cannot be equal to or less than 0.
  • time_ms - cannot be equal to or less than 0.
  • start_value - cannot be greater than value.

Iterator classes

Class Easing type Description
ServoSmoothBase None Base class for iterators
SmoothLinear Linear Linear dependence of value on time.
SmoothEaseIn EaseIn Example
SmoothEaseOut EaseOut Example
SmoothEaseInOut EaseInOut Example
SmoothEaseInQuad EaseInQuad Example
SmoothEaseOutQuad EaseOutQuad Example
SmoothEaseInOutQuad EaseInOutQuad Example
SmoothEaseInCubic EaseInCubic Example
SmoothEaseOutCubic EaseOutCubic Example
SmoothEaseInOutCubic EaseInOutCubic Example
SmoothEaseInQuart EaseInQuart Example
SmoothEaseOutQuart EaseOutQuart Example
SmoothEaseInOutQuart EaseInOutQuart Example
SmoothEaseInQuint EaseInQuint Example
SmoothEaseOutQuint EaseOutQuint Example
SmoothEaseInOutQuint EaseInOutQuint Example
SmoothEaseInExpo EaseInExpo Example
SmoothEaseOutExpo EaseOutExpo Example
SmoothEaseInOutExpo EaseInOutExpo Example
SmoothEaseInCirc EaseInCirc Example
SmoothEaseOutCirc EaseOutCirc Example
SmoothEaseInOutCirc EaseInOutCirc Example
SmoothEaseInBack EaseInBack Example
SmoothEaseOutBack EaseOutBack Example
SmoothEaseInOutBack EaseInOutBack Example

Bugs and feedback

Create an issue when you find bugs. The library is open for revision and your pull requests.

Metadata

Release files for smooth-servo 0.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for smooth-servo 0.0.2
File Size Uploaded Provenance Actions
smooth_servo-0.0.2.tar.gz 3.7 kB Without provenance Details for smooth_servo-0.0.2.tar.gz

Release files / smooth_servo-0.0.2.tar.gz

Download URL smooth_servo-0.0.2.tar.gz
Size 3.7 kB
Tags Source
SHA-256 checksum
How to use checksums
975bda655d4c01abc46fff72eed7110f73fd71ef536bb1e68a8a7dff1630e496
BLAKE2b-256 checksum
How to use checksums
807511deec7489a8cb3124616dbeddb98482dbaa4bd34f7131fe61e6e9dc3daf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.7.4

Security for smooth-servo 0.0.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.0.2 This release

1 release file No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page