API Reference
sc_servo
CircuitPython driver for Serial Controlled Servo and Motor Controllers (SCSCL) using UART.
Author(s): Jacques Supcik
Implementation Notes
Hardware:
SC09 Servo: https://www.waveshare.com/wiki/SC09_Servo
ST5215 Servo : https://www.waveshare.com/wiki/ST3215_Servo
Software and Dependencies:
Adafruit CircuitPython firmware for the supported boards: https://circuitpython.org/downloads
- class sc_servo.ScsMessage(servo_id: int, instruction: int, parameters: bytearray)
Messages for Serial Controlled Servo and Motor Controllers protocol. :param int servo_id: The ID of the servo or motor controller (between 1 and 253). :param int instruction: The instruction code to send. :param bytearray parameters: The parameters for the instruction.
- class sc_servo.SerialControlledServo(tx_pin: microcontroller.Pin, rx_pin: microcontroller.Pin, baud_rate: int = 1000000)
A bus for communicating with Serial Controlled Servo and Motor Controllers. :param ~microcontroller.Pin tx_pin: The UART transmit pin. :param ~microcontroller.Pin rx_pin: The UART receive pin. :param int baud_rate: The baud rate for the UART communication. Default is 1000000 (1MHz).
- change_id(old_servo_id: int, new_servo_id: int) None
Change the ID of a servo :param int old_servo_id: The current ID of the servo or motor controller (between 1 and 253). :param int new_servo_id: The new ID to set (between 1 and 253).
- is_moving(servo_id: int) bool
Check if a servo or motor controller is currently moving. :param int servo_id: The ID of the servo or motor controller (between 1 and 253).
- load(servo_id: int) int
Get the current load on a servo or motor controller. :param int servo_id: The ID of the servo or motor controller (between 1 and 253).
- position(servo_id: int) int
Get the current position of a servo or motor controller. :param int servo_id: The ID of the servo or motor controller (between 1 and 253).
- set_all_motor_speeds(speed: int) None
Set the speed of all servos or motor controllers as motors. :param int speed: The speed to set (between -1023 and 1023). Positive values are for clockwise rotation, negative values are for counter-clockwise rotation.
- set_all_positions(pos: int, speed: int) None
Set the position of all servos or motor controllers. :param int pos: The position to set (between 0 and 1023). :param int speed: The speed to move to the position (between 0 and 1500).
- set_motor_speed(servo_id: int, speed: int)
Set the servo to operate as a motor and set its speed. :param int servo_id: The ID of the servo or motor controller (between 1 and 253). :param int speed: The speed to set (between -1023 and 1023). Positive values are for clockwise rotation, negative values are for counter-clockwise rotation.
- set_position(servo_id: int, pos: int, speed: int) None
Set the position of a servo or motor controller. :param int servo_id: The ID of the servo or motor controller (between 1 and 253). :param int pos: The position to set (between 0 and 1023). :param int speed: The speed to move to the position (between 0 and 1500).
- speed(servo_id: int) int
Get the current speed of a servo or motor controller. :param int servo_id: The ID of the servo or motor controller (between 1 and 253).