{"id":15170118,"url":"https://github.com/cnadler86/easy-micropython-servo","last_synced_at":"2026-01-04T22:34:46.915Z","repository":{"id":245746920,"uuid":"819117223","full_name":"cnadler86/easy-micropython-servo","owner":"cnadler86","description":"a simple but powerfull llibrary for servo motors","archived":false,"fork":false,"pushed_at":"2024-07-06T20:06:21.000Z","size":19,"stargazers_count":1,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-12-25T12:21:40.684Z","etag":null,"topics":["micropython","servo"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cnadler86.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-06-23T20:32:10.000Z","updated_at":"2024-12-17T03:01:14.000Z","dependencies_parsed_at":"2024-07-06T21:23:27.152Z","dependency_job_id":"887274fd-7347-4454-9d1e-b7638395601c","html_url":"https://github.com/cnadler86/easy-micropython-servo","commit_stats":null,"previous_names":["cnadler86/easy-micropython-servo"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cnadler86%2Feasy-micropython-servo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cnadler86%2Feasy-micropython-servo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cnadler86%2Feasy-micropython-servo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cnadler86%2Feasy-micropython-servo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cnadler86","download_url":"https://codeload.github.com/cnadler86/easy-micropython-servo/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239195129,"owners_count":19598032,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["micropython","servo"],"created_at":"2024-09-27T08:00:40.401Z","updated_at":"2025-10-31T12:30:23.745Z","avatar_url":"https://github.com/cnadler86.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# easy-micropython-servo\nA MicroPython library for controlling servos using the PWM and Timer modules.\n\n## Features\n\n- Supports current ESP32 boards such as ESP32-C3/C6, ESP8266, and other ESP boards\n- Allows to control the speed of the servo\n- Allows synchronous and asynchronous servo movements\n- Dynamic timer management based on the board type\n- Provides methods to stop and detach servos\n- Includes a method to check if the servo has reached its goal angle\n\n## Usage\n\n### Importing the Library\n\n```python\nfrom easy-servo import Servo\n```\n\n### Initializing a Servo\n\n```python\nservo_pin_1 = 0  # Example pin for servo 1\nservo_pin_2 = 1  # Example pin for servo 2\n\ns1 = Servo(servo_pin_1, start=0, min_angle=0, max_angle=270, freq=50)\ns2 = Servo(servo_pin_2, start=90, min_angle=0, max_angle=180, freq=50)\n```\n\n### Moving a Servo\n\n#### Synchronous Movement\n\n```python\ns1.move(90)  # Move to 90 degrees\ns2.move(45, speed=30)  # Move to 45 degrees at 30 degrees per second\n```\n\n#### Asynchronous Movement\n\n```python\ns1.move(180, speed=30, async_mode=True)  # Move to 180 degrees asynchronously\ns2.move(45, speed=15, async_mode=True)  # Move to 45 degrees asynchronously\n\n# Wait while the servos are moving asynchronously\nimport time\ntime.sleep(10)\n\n# Check if the goal is reached\nif s1.goal_reached():\n    print(\"Servo 1 has reached its goal.\")\nif s2.goal_reached():\n    print(\"Servo 2 has reached its goal.\")\n```\n\n### Stopping a Servo\n\n```python\ns1.stop()\ns2.stop()\n```\n\n### Detaching a Servo\n\n```python\ns1.detach()\ns2.detach()\n```\n\n## API Reference\n\n### `Servo` Class\n\n#### `__init__(self, pin, start=0, *, min_angle=0, max_angle=180, freq=50, pulse_min=0.5, pulse_max=2.5)`\n\nInitializes the servo object.\n\n- `pin`: The pin to which the servo is connected.\n- `start`: Starting angle of the servo.\n- `min_angle`: Minimum angle of the servo in degrees.\n- `max_angle`: Maximum angle of the servo in degrees.\n- `freq`: PWM frequency.\n- `pulse_min`: Minimum pulse width in milliseconds.\n- `pulse_max`: Maximum pulse width in milliseconds.\n\n#### `move(self, target_angle, speed=None, async_mode=False)`\n\nMoves the servo to a specific angle.\n\n- `target_angle`: Target angle.\n- `speed`: Speed of movement in degrees per second.\n- `async_mode`: `True` for asynchronous movement, `False` for synchronous movement.\n\n#### `stop(self)`\n\nStops the servo movement and releases the timer.\n\n#### `detach(self)`\n\nDetaches the servo.\n\n#### `goal_reached(self)`\n\nChecks if the servo has reached its target angle.\n\n- Returns `True` if the servo has reached its target angle, `False` otherwise.\n\n## Contributing\n\nContributions are welcome! Please open an issue or submit a pull request.\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcnadler86%2Feasy-micropython-servo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcnadler86%2Feasy-micropython-servo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcnadler86%2Feasy-micropython-servo/lists"}