This is a servo motor control library for Raspberry Pi.
Project description
piServoCtl
Overview
This is a servo motor control library for Raspberry Pi. In addition to normal servo motors, continuous rotation servo motors can also be controlled.
It utilizes hardware PWM. Therefore, the servo motor can be moved smoothly. Since you are using pigpio, you need to install pigpio and start pigpiod. To start pigpiod, you need to press the sudo pigpiod
command or make pigpiod start automatically.
Installation
pip install piServoCtl
Demo
from piservo import Servo
import subprocess
import time
subprocess.call(['sudo', 'pigpiod'])
time.sleep(1)
myservo = Servo(12)
myservo.write(180)
time.sleep(3)
myservo.write(0)
time.sleep(3)
myservo.stop()
Usage
Method
Servo(gpio, min_value=0, max_value=180, min_pulse=0.5, max_pulse=2.4, frequency=50)
gpio: The gpio pin number to which the servo motor is connected.
min_value: Minimum angle of servo motor (speed if it is a rotation servo motor).
max_value: Maximum angle of servo motor (speed if it is a rotation servo motor).
min_pulse: Minimum control pulse width of servo motor (millisecond).
max_pulse: Maximum control pulse width of servo motor (millisecond).
frequency: PWM frequency of the servo motor.
Create an instance.
Servo.write(value)
value: Servo motor drive angle (speed if it is a rotation servo motor).
Drives the servo motor.
Servo.read()
Read the current value of the servo motor.
Servo.start()
Starts control of the servo motor.
Servo.stop()
Stops control of the servo motor.
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distributions
Hashes for piServoCtl-1.0.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f9fcc9467e98995fe2933e123fd6ad36e081bb3acbb22a874da9b2e30473e75e |
|
MD5 | b8907555da3bb20086487da5ed053d05 |
|
BLAKE2b-256 | 8718b1147702087cd629c9a9deed08dc4f69f5380124b99bed0546037ce3cb26 |
Hashes for piServoCtl-1.0.0-py2-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ff5d8dba912f3f0ae384bb4b603e03c954a11b9c6a1404450abb00e779818b93 |
|
MD5 | e2cebc1f147d23ea4929dd4fcdbc58a4 |
|
BLAKE2b-256 | 65f350db5b8d5a9c51a6d55d10bb066e6ae6b81622e3b810cab621310cf9eaf9 |