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
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
Metadata
Release files for micropython-servo 1.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| micropython-servo-1.0.1.tar.gz | 3.2 kB | Without provenance | Details for micropython-servo-1.0.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| micropython_servo-1.0.1-py3-none-any.whl | Python 3 | none | any | Details for micropython_servo-1.0.1-py3-none-any.whl |
Total release size: 7.3 kB
Release files / micropython-servo-1.0.1.tar.gz
| Download URL | micropython-servo-1.0.1.tar.gz |
|---|---|
| Size | 3.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3c39c0abcde5223867105915568e86deb513df62b5064db1cad0a6cf9b822894
|
|
BLAKE2b-256 checksum How to use checksums |
514b990de6fb0f1ac34022d8a953cbd88f80e1b9c665090a125076e86aeb69cf
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.8
|
Release files / micropython_servo-1.0.1-py3-none-any.whl
| Download URL | micropython_servo-1.0.1-py3-none-any.whl |
|---|---|
| Size | 4.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
10dae185da7ae27dc6c8e149b3f1fb254665391d08db5fb5f70fb00dfbf4fbc8
|
|
BLAKE2b-256 checksum How to use checksums |
34fa00697659cf16510963fe3d4ff28ad6896eaff73251928bc47e4e02518bf2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.8
|
Security for micropython-servo 1.0.1
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.