Skip to main content

CircuitPython library for Serial Servo Bus (UART)

Project description

Introduction

Documentation Status Discord Build Status https://img.shields.io/badge/code%20style-black-000000.svg Code Style: Ruff

CircuitPython driver for Serial Controlled Servo and Motor Controllers (SCSCL) using UART.

Dependencies

This driver depends on:

Please ensure all dependencies are available on the CircuitPython filesystem. This is easily achieved by downloading the Adafruit library and driver bundle or individual libraries can be installed using circup.

Installing from PyPI

On supported GNU/Linux systems like the Raspberry Pi, you can install the driver locally from PyPI. To install for current user:

pip3 install CircuitPython-sc_servo

To install system-wide (this may be required in some cases):

sudo pip3 install CircuitPython-serial-controlled-servo

To install in a virtual environment in your current project:

mkdir project-name && cd project-name
python3 -m venv .venv
source .env/bin/activate
pip3 install CircuitPython-serial-controlled-servo

Installing to a Connected CircuitPython Device with Circup

Make sure that you have circup installed in your Python environment. Install it with the following command if necessary:

pip3 install circup

With circup installed and your CircuitPython device connected use the following command to install:

circup install circuitpython_sc_servo

Or the following command to update an existing version:

circup update

Usage Example

import time

import board
from sc_servo import SerialControlledServo

POSITIONS = [0, 307, 614, 307]
SPEED = 1000
# Replace boards.IO02 and board.IO01 with the appropriate pins for your board
servo = SerialControlledServo(tx_pin=board.IO02, rx_pin=board.IO01)
index: int = 0
while True:
    servo.set_position(servo_id=1, pos=POSITIONS[index], speed=SPEED)
    index = (index + 1) % len(POSITIONS)
    while servo.is_moving(servo_id=1):
        time.sleep(0.1)
    time.sleep(0.5)  # Wait 1/2 second

Documentation

API documentation for this library can be found on Read the Docs.

For information on building library documentation, please check out this guide.

Contributing

Contributions are welcome! Please read our Code of Conduct before contributing to help this project stay welcoming.

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

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

File details

Details for the file circuitpython_serial_controlled_servo-0.1.3.tar.gz.

File metadata

File hashes

Hashes for circuitpython_serial_controlled_servo-0.1.3.tar.gz
Algorithm Hash digest
SHA256 9c4d6eb6ddea7578626b2c902921911fbc8c2ae5f70e10bf270659c053e01b15
MD5 7ffb1658cfc660fd12ea049f0d010a7a
BLAKE2b-256 5c728c8292cbfe952af5fd4739f8d830f8908cb86632165af793a1f8f09cbdae

See more details on using hashes here.

File details

Details for the file circuitpython_serial_controlled_servo-0.1.3-py3-none-any.whl.

File metadata

File hashes

Hashes for circuitpython_serial_controlled_servo-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 3bbbdaa3dca6403b12d1a396a082906e7872c89ac797bf50da4ed51a6ca942a0
MD5 38f4de924d5c4933a5ecbcb8b3cb98b3
BLAKE2b-256 75222215b7605d2f096f26610b32dff06c117bb826446e731b2c5c007ab6cdfa

See more details on using hashes here.

Supported by

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