> ## Documentation Index
> Fetch the complete documentation index at: https://motorbridge.seeedstudio.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Cross-language Examples

## Channel Compatibility (PCAN + slcan + Damiao Serial Bridge)

* Linux SocketCAN uses interface names directly: `can0`, `can1`, `slcan0`.
* For USB-serial CAN adapters, bring up `slcan0` first: `sudo slcand -o -c -s8 /dev/ttyUSB0 slcan0 && sudo ip link set slcan0 up`.
* Damiao-only serial bridge transport is also available in CLI (`--transport dm-serial --serial-port /dev/ttyACM0 --serial-baud 921600`).
* On Linux SocketCAN, do not append bitrate in `--channel` (for example `can0@1000000` is invalid).
* On Windows (PCAN backend), `can0/can1` map to `PCAN_USBBUS1/2`; optional `@bitrate` suffix is supported.

## Index

* Rust CLI: `motor_cli/src/main.rs`
* C ABI: `examples/c/c_abi_demo.c`
* C++ ABI: `examples/cpp/cpp_abi_demo.cpp`
* Python ctypes: `examples/python/python_ctypes_demo.py`
* Multi-vendor position sync script: `examples/python/four_vendor_pos_sync.py`
* WS quad sync HMI: `examples/web/ws_quad_sync_hmi.html`
* Python SDK: `bindings/python/examples/*`
* C++ wrapper: `bindings/cpp/examples/*`

## Quick Commands

```bash theme={null}
cargo build -p motor_abi --release
```

Damiao Python ctypes:

```bash theme={null}
python3 examples/python/python_ctypes_demo.py --vendor damiao --channel can0 --model 4340P --motor-id 0x01 --feedback-id 0x11 --mode mit
```

RobStride Python ctypes:

```bash theme={null}
python3 examples/python/python_ctypes_demo.py --vendor robstride --channel can0 --model rs-06 --motor-id 127 --mode ping
```

RobStride C ABI:

```bash theme={null}
cc examples/c/c_abi_demo.c -I motor_abi/include -L target/release -lmotor_abi -o c_abi_demo
LD_LIBRARY_PATH=target/release ./c_abi_demo --vendor robstride --channel can0 --model rs-06 --motor-id 127 --mode read-param --param-id 0x7019 --param-type f32
```

Multi-vendor position sync helper:

```bash theme={null}
python3 examples/python/four_vendor_pos_sync.py \
  damiao 0x01 damiao 0x07 myactuator 1 hightorque 1 \
  --pos 1.57 \
  --damiao-model-by-id "0x01=4340P,0x07=4310" \
  --stagger-ms 50
```

Web HMI (single slider controls 4 motors to the same angle):

```bash theme={null}
cargo run -p ws_gateway --release -- --bind 127.0.0.1:9002 --vendor damiao --channel can0 --model 4340P --motor-id 0x01 --feedback-id 0x11 --dt-ms 20
python3 -m http.server 18080
# open http://127.0.0.1:18080/examples/web/ws_quad_sync_hmi.html
```
