# Vibration API

## 1. Overview

This document introduces how to send vibration control commands to HandDriver via the UDP protocol to trigger vibration feedback for the vibrators of the glove.

{% hint style="warning" %}
Please ensure that it is used within the same local area network (LAN).
{% endhint %}

## 2. Usage Instructions

### 2.1. Basic Parameters

* **Protocol**: UDP
* **Port**: 8920
* **IP Address**: Local IP or assign a specific IP
* **Data Format**: JSON

### 2.2. Data Format

{% code overflow="wrap" %}

```json
{
    "ctrl": { // character name
        "LeftHand": [ // 
            {"Name": "Vibrators","Value": 0}, // vibrators number ( (int)0~3 );0-none,1-vib1,2-vib2,3-both
            
            {"Name": "Duration","Value": 0.04}, // time value ( (float)0.04~2.5 )
            
            {"Name": "Amplitude","Value": 4} // intensity value ( (int)4~10 )
        ],
        "RightHand": [
            {"Name": "Vibrators","Value": 2}, // vibrators number ( (int)0~3 );0-none,1-vib1,2-vib2,3-both
            
            {"Name": "Duration","Value": 1}, // time value ( (float)0.04~2.5 )
            {"Name": "Amplitude","Value": 4} // intensityvalue ( (int)4~10 )
        ]
    }
}
```

{% endcode %}

### 2.3. Parameter Description

* **Vibrators**: Vibration motor ID (0-3), Vibrator 1 is under the buttons and Virbrator 2 is under the joystick
* **Duration**: Vibration duration (seconds)
* **Amplitude**: Vibration intensity (4-10)
