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:
- Material [CSS Transitions](https://developer.mozilla.org/en-US/docs/Web/CSS/transition-timing-function), by MDN
- Material [easings.net](https://easings.net/en) by Andrey Sitnik and Ivan Solovev
### 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
- [Install](https://github.com/TTitanUA/servo_smooth#install)
- [Initialization](https://github.com/TTitanUA/servo_smooth#init)
- [Documentation](https://github.com/TTitanUA/servo_smooth#doc)
- [Bugs and feedback](https://github.com/TTitanUA/servo_smooth#feedback)
<a id="install"></a>
## Installation
- Install the library via pip (Thonny -> Manage Packages) by name **smooth-servo**
- Or manual installation:
- [Download library from GitHub](https://github.com/TTitanUA/servo_smooth)
- take the **smooth_servo** folder from the archive.
- upload to the root of the microcontroller or to the **lib** folder.
<a id="init"></a>
## Usage
This library is primarily designed to be used with my servo libraries.
But you can also use it in other projects like this:
```python
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)
```
<a id="doc"></a>
## 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](https://easings.net/en#easeInSine) |
| SmoothEaseOut | EaseOut | [Example](https://easings.net/en#easeOutSine) |
| SmoothEaseInOut | EaseInOut | [Example](https://easings.net/en#easeInOutSine) |
| SmoothEaseInQuad | EaseInQuad | [Example](https://easings.net/en#easeInQuad) |
| SmoothEaseOutQuad | EaseOutQuad | [Example](https://easings.net/en#easeOutQuad) |
| SmoothEaseInOutQuad | EaseInOutQuad | [Example](https://easings.net/en#easeInOutQuad) |
| SmoothEaseInCubic | EaseInCubic | [Example](https://easings.net/en#easeInCubic) |
| SmoothEaseOutCubic | EaseOutCubic | [Example](https://easings.net/en#easeOutCubic) |
| SmoothEaseInOutCubic | EaseInOutCubic | [Example](https://easings.net/en#easeInOutCubic) |
| SmoothEaseInQuart | EaseInQuart | [Example](https://easings.net/en#easeInQuart) |
| SmoothEaseOutQuart | EaseOutQuart | [Example](https://easings.net/en#easeOutQuart) |
| SmoothEaseInOutQuart | EaseInOutQuart | [Example](https://easings.net/en#easeInOutQuart) |
| SmoothEaseInQuint | EaseInQuint | [Example](https://easings.net/en#easeInQuint) |
| SmoothEaseOutQuint | EaseOutQuint | [Example](https://easings.net/en#easeOutQuint) |
| SmoothEaseInOutQuint | EaseInOutQuint | [Example](https://easings.net/en#easeInOutQuint) |
| SmoothEaseInExpo | EaseInExpo | [Example](https://easings.net/en#easeInExpo) |
| SmoothEaseOutExpo | EaseOutExpo | [Example](https://easings.net/en#easeOutExpo) |
| SmoothEaseInOutExpo | EaseInOutExpo | [Example](https://easings.net/en#easeInOutExpo) |
| SmoothEaseInCirc | EaseInCirc | [Example](https://easings.net/en#easeInCirc) |
| SmoothEaseOutCirc | EaseOutCirc | [Example](https://easings.net/en#easeOutCirc) |
| SmoothEaseInOutCirc | EaseInOutCirc | [Example](https://easings.net/en#easeInOutCirc) |
| SmoothEaseInBack | EaseInBack | [Example](https://easings.net/en#easeInBack) |
| SmoothEaseOutBack | EaseOutBack | [Example](https://easings.net/en#easeOutBack) |
| SmoothEaseInOutBack | EaseInOutBack | [Example](https://easings.net/en#easeInOutBack) |
<a id="feedback"></a>
## Bugs and feedback
Create an [issue](https://github.com/TTitanUA/servo_smooth/issues) when you find bugs.
The library is open for revision and your [pull requests](https://github.com/TTitanUA/servo_smooth/pulls).
Raw data
{
"_id": null,
"home_page": "https://github.com/TTitanUA/servo_smooth",
"name": "smooth-servo",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.5",
"maintainer_email": "",
"keywords": "micropython,servo easing",
"author": "TTitanUA",
"author_email": "xttitanx@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/80/75/11deec7489a8cb3124616dbeddb98482dbaa4bd34f7131fe61e6e9dc3daf/smooth_servo-0.0.2.tar.gz",
"platform": "micropython",
"description": "This is an automatic translation, may be incorrect in some places.\n# Smooth Servo Library\nThis library is a collection of deceleration options for my servo libraries.\nSince this functionality is not mandatory, I decided to move it to a separate library.\n\nLibrary features:\n- Allows you to create iterators based on: value, time, regrettable slowdown.\n\n\nMaterials used to create the library:\n- Material [CSS Transitions](https://developer.mozilla.org/en-US/docs/Web/CSS/transition-timing-function), by MDN\n- Material [easings.net](https://easings.net/en) by Andrey Sitnik and Ivan Solovev\n\n### Compatibility\n- MicroPython 1.19.1\n- Raspberry Pi Pico\n\nOn the hardware above the library has been tested and works correctly.\n\n### ATTENTION\nYou use this module at your own risk.\nI am new to MicroPython programming. So there may be nuances that I did not take into account.\nIf you notice an error or have suggestions for improvement, please write to Issues.\n\n## Contents\n- [Install](https://github.com/TTitanUA/servo_smooth#install)\n- [Initialization](https://github.com/TTitanUA/servo_smooth#init)\n- [Documentation](https://github.com/TTitanUA/servo_smooth#doc)\n- [Bugs and feedback](https://github.com/TTitanUA/servo_smooth#feedback)\n\n<a id=\"install\"></a>\n## Installation\n- Install the library via pip (Thonny -> Manage Packages) by name **smooth-servo**\n- Or manual installation:\n - [Download library from GitHub](https://github.com/TTitanUA/servo_smooth)\n - take the **smooth_servo** folder from the archive.\n - upload to the root of the microcontroller or to the **lib** folder.\n\n<a id=\"init\"></a>\n## Usage\nThis library is primarily designed to be used with my servo libraries.\nBut you can also use it in other projects like this:\n\n```python\nfrom smooth_servo import SmoothLinear\n\n# Set parameters\nvalue = 100 # End value the iterator should reach\ntime_ms = 1000 # Time in milliseconds to reach end value\nstart_value = 0 # Start value\ntick_time_ms = 50 # Time between iterations (used to calculate the number of steps)\n\n# Create an instance of the iterator class\nlinear = SmoothLinear(value, time_ms, start_value)\n\n# create an iterator with a given time between iterations\niterator = linear.generate(tick_time_ms)\n\n# Use an iterator\nfor i in iterator:\n print(i)\n```\n\n<a id=\"doc\"></a>\n## Documentation\n### Constructor parameters\n\n| Parameter | type | default | description |\n|-------------|------|---------|------------------------------------------------------------|\n| value | int | None | End value |\n| time_ms | int | None | The time in milliseconds it takes to reach the final value |\n| start_value | int | 0 | Initial value |\n\n- `value` - cannot be equal to or less than 0.\n- `time_ms` - cannot be equal to or less than 0.\n- `start_value` - cannot be greater than `value`.\n\n### Iterator classes\n\n| Class | Easing type | Description |\n|----------------------|----------------|--------------------------------------------------|\n| ServoSmoothBase | None | Base class for iterators |\n| SmoothLinear | Linear | Linear dependence of value on time. |\n| SmoothEaseIn | EaseIn | [Example](https://easings.net/en#easeInSine) |\n| SmoothEaseOut | EaseOut | [Example](https://easings.net/en#easeOutSine) |\n| SmoothEaseInOut | EaseInOut | [Example](https://easings.net/en#easeInOutSine) |\n| SmoothEaseInQuad | EaseInQuad | [Example](https://easings.net/en#easeInQuad) |\n| SmoothEaseOutQuad | EaseOutQuad | [Example](https://easings.net/en#easeOutQuad) |\n| SmoothEaseInOutQuad | EaseInOutQuad | [Example](https://easings.net/en#easeInOutQuad) |\n| SmoothEaseInCubic | EaseInCubic | [Example](https://easings.net/en#easeInCubic) |\n| SmoothEaseOutCubic | EaseOutCubic | [Example](https://easings.net/en#easeOutCubic) |\n| SmoothEaseInOutCubic | EaseInOutCubic | [Example](https://easings.net/en#easeInOutCubic) |\n| SmoothEaseInQuart | EaseInQuart | [Example](https://easings.net/en#easeInQuart) |\n| SmoothEaseOutQuart | EaseOutQuart | [Example](https://easings.net/en#easeOutQuart) |\n| SmoothEaseInOutQuart | EaseInOutQuart | [Example](https://easings.net/en#easeInOutQuart) |\n| SmoothEaseInQuint | EaseInQuint | [Example](https://easings.net/en#easeInQuint) |\n| SmoothEaseOutQuint | EaseOutQuint | [Example](https://easings.net/en#easeOutQuint) |\n| SmoothEaseInOutQuint | EaseInOutQuint | [Example](https://easings.net/en#easeInOutQuint) |\n| SmoothEaseInExpo | EaseInExpo | [Example](https://easings.net/en#easeInExpo) |\n| SmoothEaseOutExpo | EaseOutExpo | [Example](https://easings.net/en#easeOutExpo) |\n| SmoothEaseInOutExpo | EaseInOutExpo | [Example](https://easings.net/en#easeInOutExpo) |\n| SmoothEaseInCirc | EaseInCirc | [Example](https://easings.net/en#easeInCirc) |\n| SmoothEaseOutCirc | EaseOutCirc | [Example](https://easings.net/en#easeOutCirc) |\n| SmoothEaseInOutCirc | EaseInOutCirc | [Example](https://easings.net/en#easeInOutCirc) |\n| SmoothEaseInBack | EaseInBack | [Example](https://easings.net/en#easeInBack) |\n| SmoothEaseOutBack | EaseOutBack | [Example](https://easings.net/en#easeOutBack) |\n| SmoothEaseInOutBack | EaseInOutBack | [Example](https://easings.net/en#easeInOutBack) |\n\n<a id=\"feedback\"></a>\n## Bugs and feedback\nCreate an [issue](https://github.com/TTitanUA/servo_smooth/issues) when you find bugs.\nThe library is open for revision and your [pull requests](https://github.com/TTitanUA/servo_smooth/pulls).",
"bugtrack_url": null,
"license": "MIT",
"summary": "This library provides a set of slowdowns for my servo packages.",
"version": "0.0.2",
"split_keywords": [
"micropython",
"servo easing"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "807511deec7489a8cb3124616dbeddb98482dbaa4bd34f7131fe61e6e9dc3daf",
"md5": "fec998256abf06586ea3a1efacf44e7e",
"sha256": "975bda655d4c01abc46fff72eed7110f73fd71ef536bb1e68a8a7dff1630e496"
},
"downloads": -1,
"filename": "smooth_servo-0.0.2.tar.gz",
"has_sig": false,
"md5_digest": "fec998256abf06586ea3a1efacf44e7e",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.5",
"size": 3660,
"upload_time": "2023-02-11T15:52:02",
"upload_time_iso_8601": "2023-02-11T15:52:02.916226Z",
"url": "https://files.pythonhosted.org/packages/80/75/11deec7489a8cb3124616dbeddb98482dbaa4bd34f7131fe61e6e9dc3daf/smooth_servo-0.0.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-02-11 15:52:02",
"github": true,
"gitlab": false,
"bitbucket": false,
"github_user": "TTitanUA",
"github_project": "servo_smooth",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "smooth-servo"
}