micropython-servo


Namemicropython-servo JSON
Version 1.0.1 PyPI version JSON
download
home_page
SummaryUse rc servos with PWM in micropython in a tidy way
upload_time2023-01-09 08:42:39
maintainer
docs_urlNone
author
requires_python
licenseMIT License Copyright (c) 2023 redoxcode Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
keywords servo pwm
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            [![pypi version shield](https://img.shields.io/pypi/v/micropython-servo)](https://pypi.org/project/micropython-servo/) [![pypi downloads per month shield](https://img.shields.io/pypi/dm/micropython-servo?color=brightgreen)](https://pypi.org/project/micropython-servo/)
## Description
A micropython library to control rc servos in a tidy way. 

This uses hardware PWM as an efficient way to generate the ouput signal. 
But therefore servos need to be connected to pins with PWM functionallity.

The servos can be calibrated using 2 points (min / max position).
The default values should work for most servos, but won't set the servo to the exact position, as these values are different for each servo model.

## Examples
### Move servo
```Python
import time
from servo import Servo
my_servo = Servo(pin_id=28)
my_servo.write(30)
time.sleep(2.0)
my_servo.write(60)
time.sleep(2.0)
my_servo.write(90)

```

## API
### class Servo(pin_id,min_us=544.0,max_us=2400.0,min_deg=0.0,max_deg=180.0,freq=50)
- pin_id: id of the pin connected to the servo
- min_us: minimal pulse width (calibration point 1 / there is no clipping if you try to set the servo to a lower value)
- max_us: maximal pulse width (calibration point 2 / there is no clipping if you try to set the servo to a higher value)
- min_deg: minimal position in degrees (calibration point 1 / there is no clipping if you try to set the servo to a lower value)
- max_deg: maximal position in degrees (calibration point 2 / there is no clipping if you try to set the servo to a higher value)

```write(deg)```
- move the servo to the given position
- deg: Position in degrees

```read()```
- returns the position last set in degrees

```write_rad(rad)```
- move the servo to the given position
- rad: Position in radians

```read_rad()```
- returns the position last set in radians

```write_us(us)```
- set the pulse width for the servo
- us: Pulse width in us

```read_us()```
- returns the last set puls width

```off()```
- disables the output

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "micropython-servo",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "servo,PWM",
    "author": "",
    "author_email": "redoxcode <redoxcode@github.com>",
    "download_url": "https://files.pythonhosted.org/packages/51/4b/990de6fb0f1ac34022d8a953cbd88f80e1b9c665090a125076e86aeb69cf/micropython-servo-1.0.1.tar.gz",
    "platform": null,
    "description": "[![pypi version shield](https://img.shields.io/pypi/v/micropython-servo)](https://pypi.org/project/micropython-servo/) [![pypi downloads per month shield](https://img.shields.io/pypi/dm/micropython-servo?color=brightgreen)](https://pypi.org/project/micropython-servo/)\n## Description\nA micropython library to control rc servos in a tidy way. \n\nThis uses hardware PWM as an efficient way to generate the ouput signal. \nBut therefore servos need to be connected to pins with PWM functionallity.\n\nThe servos can be calibrated using 2 points (min / max position).\nThe default values should work for most servos, but won't set the servo to the exact position, as these values are different for each servo model.\n\n## Examples\n### Move servo\n```Python\nimport time\nfrom servo import Servo\nmy_servo = Servo(pin_id=28)\nmy_servo.write(30)\ntime.sleep(2.0)\nmy_servo.write(60)\ntime.sleep(2.0)\nmy_servo.write(90)\n\n```\n\n## API\n### class Servo(pin_id,min_us=544.0,max_us=2400.0,min_deg=0.0,max_deg=180.0,freq=50)\n- pin_id: id of the pin connected to the servo\n- min_us: minimal pulse width (calibration point 1 / there is no clipping if you try to set the servo to a lower value)\n- max_us: maximal pulse width (calibration point 2 / there is no clipping if you try to set the servo to a higher value)\n- min_deg: minimal position in degrees (calibration point 1 / there is no clipping if you try to set the servo to a lower value)\n- max_deg: maximal position in degrees (calibration point 2 / there is no clipping if you try to set the servo to a higher value)\n\n```write(deg)```\n- move the servo to the given position\n- deg: Position in degrees\n\n```read()```\n- returns the position last set in degrees\n\n```write_rad(rad)```\n- move the servo to the given position\n- rad: Position in radians\n\n```read_rad()```\n- returns the position last set in radians\n\n```write_us(us)```\n- set the pulse width for the servo\n- us: Pulse width in us\n\n```read_us()```\n- returns the last set puls width\n\n```off()```\n- disables the output\n",
    "bugtrack_url": null,
    "license": "MIT License  Copyright (c) 2023 redoxcode  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.  ",
    "summary": "Use rc servos with PWM in micropython in a tidy way",
    "version": "1.0.1",
    "split_keywords": [
        "servo",
        "pwm"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "34fa00697659cf16510963fe3d4ff28ad6896eaff73251928bc47e4e02518bf2",
                "md5": "b95b6873dc432497fe71531aa51af614",
                "sha256": "10dae185da7ae27dc6c8e149b3f1fb254665391d08db5fb5f70fb00dfbf4fbc8"
            },
            "downloads": -1,
            "filename": "micropython_servo-1.0.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "b95b6873dc432497fe71531aa51af614",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 4083,
            "upload_time": "2023-01-09T08:42:38",
            "upload_time_iso_8601": "2023-01-09T08:42:38.273360Z",
            "url": "https://files.pythonhosted.org/packages/34/fa/00697659cf16510963fe3d4ff28ad6896eaff73251928bc47e4e02518bf2/micropython_servo-1.0.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "514b990de6fb0f1ac34022d8a953cbd88f80e1b9c665090a125076e86aeb69cf",
                "md5": "2eba07bb1bbfb9c3e723b80b7081e97d",
                "sha256": "3c39c0abcde5223867105915568e86deb513df62b5064db1cad0a6cf9b822894"
            },
            "downloads": -1,
            "filename": "micropython-servo-1.0.1.tar.gz",
            "has_sig": false,
            "md5_digest": "2eba07bb1bbfb9c3e723b80b7081e97d",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 3214,
            "upload_time": "2023-01-09T08:42:39",
            "upload_time_iso_8601": "2023-01-09T08:42:39.894629Z",
            "url": "https://files.pythonhosted.org/packages/51/4b/990de6fb0f1ac34022d8a953cbd88f80e1b9c665090a125076e86aeb69cf/micropython-servo-1.0.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-01-09 08:42:39",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "lcname": "micropython-servo"
}
        
Elapsed time: 0.02602s