Skip to main content

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


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)

Uploaded Source

Built Distribution

pwm_servo_driver-0.1.0-py2.py3-none-any.whl (15.1 kB view hashes)

Uploaded Python 2 Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page