Vai al contenuto
GET /v1/pulse

Pulse width for a target angle

Provalo dal vivo

10 chiamate gratuite al giorno — senza registrazione, senza chiave API. Passa dal gateway oanor.

Intestazioni personalizzate (facoltative)
api.oanor.com/servo-api

Funziona. Prendi una chiave API e usala nel tuo progetto.

Ottieni una chiave API

Frammenti di codice

curl "https://api.oanor.com/servo-api/v1/pulse" \
  -H "x-oanor-key: oanor_test_..."
await fetch("https://api.oanor.com/servo-api/v1/pulse", {
  headers: { "x-oanor-key": "oanor_test_..." }
});
$ch = curl_init("https://api.oanor.com/servo-api/v1/pulse");
curl_setopt($ch, CURLOPT_HTTPHEADER, ["x-oanor-key: oanor_test_..."]);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$out = curl_exec($ch);
import requests
requests.get(
    "https://api.oanor.com/servo-api/v1/pulse",
    headers={"x-oanor-key": "oanor_test_..."}
)

Risposta di esempio

Una risposta reale di questo endpoint, acquisita dall'ultimo health check.

{
    "data": {
        "note": "The pulse width for an angle inverts the servo map: pulse = min + (angle ÷ travel) × the min-to-max span, so on a 1000–2000 µs / 180° servo, 90° is 1500 µs and 45° is 1250 µs. This is the number a microcontroller writes to the servo each frame (about every 20 ms); libraries like Arduino's Servo take the angle and do exactly this conversion under the hood.",
        "inputs": {
            "max_us": 2000,
            "min_us": 1000,
            "angle_deg": 90,
            "range_deg": 180
        },
        "pulse_us": 1500
    },
    "meta": {
        "timestamp": "2026-06-06T23:53:51.426Z",
        "request_id": "5d1b7465-abbe-47c5-9dfb-058d473df9c1"
    },
    "status": "ok",
    "message": "Servo pulse",
    "success": true
}