Ir al contenido
GET /v1/angle

Servo angle from a pulse width

Pruébalo en vivo

10 llamadas gratis al día — sin registro, sin clave API. Pasa por el gateway de oanor.

Encabezados personalizados (opcional)
api.oanor.com/servo-api

Funciona. Consigue una clave API y úsala en tu proyecto.

Obtener una clave API

Fragmentos de código

curl "https://api.oanor.com/servo-api/v1/angle" \
  -H "x-oanor-key: oanor_test_..."
await fetch("https://api.oanor.com/servo-api/v1/angle", {
  headers: { "x-oanor-key": "oanor_test_..." }
});
$ch = curl_init("https://api.oanor.com/servo-api/v1/angle");
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/angle",
    headers={"x-oanor-key": "oanor_test_..."}
)

Respuesta de ejemplo

Una respuesta real de este endpoint, capturada en la última comprobación de estado.

{
    "data": {
        "note": "A hobby RC servo reads the width of the pulse, not a PWM duty cycle: the standard 1000–2000 µs maps linearly across the travel, with 1500 µs at centre. angle = (pulse − min) ÷ (min-to-max span) × the travel. Many servos accept a wider 500–2500 µs for extra throw, but pushing past the mechanical stops strains the gears — the unclamped value here shows when a pulse asks for more than the configured range.",
        "inputs": {
            "max_us": 2000,
            "min_us": 1000,
            "pulse_us": 1500,
            "range_deg": 180
        },
        "angle_deg": 90,
        "out_of_range": false,
        "angle_unclamped_deg": 90
    },
    "meta": {
        "timestamp": "2026-06-06T23:53:51.218Z",
        "request_id": "2cd4666b-66c4-47f0-bafd-ad4e6ac3282e"
    },
    "status": "ok",
    "message": "Servo angle",
    "success": true
}