Python interface for PWM servo driver
Project description
PWM Servo Driver Python Package
This package provides a Python interface for controlling servos using Pulse Width Modulation (PWM).
Prerequisites
This library requires the sx1509-gpio-expander
library. You can install it using pip:
pip install sx1509-gpio-expander
Installation
Install the package using pip:
pip install pwm-servo-driver
Usage
from sx1509_gpio_expander import SX1509
from pwm_servo_driver import Servo
import board
# Configure I2C
i2c = board.I2C()
# Create an instance of the SX1509 GPIO expander
IOExpander0 = SX1509.SX1509(i2c, 0x3F)
# Create an instance of the PWM servo driver
# The parameters are the IO expander, and the pin number for the servo
servo = Servo.Servo(IOExpander0, 1)
# Use the servo driver
# The setPosition function sets the servo angle
# Just set the angle to a value between (0-180) and the function will automatically adjust the PWM signal
servo.setPosition(90)
License
This project is licensed under the GNU GENERAL PUBLIC LICENSE - see the LICENSE file for details.
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 Distribution
pwm_servo_driver-0.1.0.tar.gz
(15.4 kB
view hashes)
Built Distribution
Close
Hashes for pwm_servo_driver-0.1.0-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5ce8f9b38562c89add8190b11cf65552aa6d22fd9d48d22b28951dbae99509e4 |
|
MD5 | e27cc0975050c88170897637de8936f5 |
|
BLAKE2b-256 | 26aab4d359d2a37c5be56f69f3dc8ba7c2f69b12485720972c5af2df8cb06917 |