| Crates.io | lx16a-servo |
| lib.rs | lx16a-servo |
| version | 0.2.1 |
| created_at | 2025-10-11 01:23:22.953651+00 |
| updated_at | 2025-10-13 00:01:57.609592+00 |
| description | Abstraction library for controlling Hiwonder LX-16A servos over UART. |
| homepage | https://github.com/abagul1/lx16a-servo |
| repository | https://github.com/abagul1/lx16a-servo |
| max_upload_size | |
| id | 1877714 |
| size | 59,190 |
This library provides idiomatic Rust abstractions for controlling Hiwonder LX-16A serial bus servos.
It offers a simple, minimal-setup interface for initializing the servo bus, commanding motion, and reading servo state.
Add to your Cargo.toml:
[dependencies]
lx16a-servo = "0.2.0"
Connect the Bus Linker to your computer before running any examples. On macOS, your serial device is typically under /dev/tty.usbserial-*. Adjust the PATH constant in each example accordingly.
move_single_servoBasic example demonstrating single servo control with position moves.
cargo run --example move_single_servo
Features:
assign_servo_idReassign a servo's ID (useful when setting up new servos or resolving ID conflicts).
cargo run --example assign_servo_id
Features:
CURRENT_ID to NEW_IDImportant: Only connect one servo to the bus when changing IDs to avoid conflicts.
multi_servo_controlDemonstrates synchronized multi-servo control using ServoController.
cargo run --example multi_servo_control
Features:
Configure servo IDs using the S1 and S2 constants in the example.
Hardware integration tests are available in tests/hardware_tests.rs. These tests require a physical servo connected to the bus.
Configure your hardware setup by editing the constants at the top of the test file:
const PATH: &str = "/dev/tty.usbserial-210";
const BAUD: u32 = 115_200;
const TEST_SERVO_ID: u8 = 1;
Run all hardware tests (requires connected servo):
cargo test -- --ignored
Run a specific test:
cargo test test_read_position -- --ignored
List all available tests:
cargo test -- --ignored --list
Note:
#[ignore = "requires hardware"] since they need a physical servo. Use the --ignored flag to run them.serial_test crate to prevent conflicts accessing the serial port.serialport crate.This project is licensed under the MIT License.