Aller au contenu
GET /v1/angle

Servo angle from a pulse width

Essayez-le en direct

10 appels gratuits par jour — sans inscription, sans clé API. Passe par la passerelle oanor.

En-têtes personnalisés (facultatif)
api.oanor.com/servo-api

Ça marche. Récupérez une clé API et utilisez-la dans votre projet.

Obtenez une clé API

Extraits de code

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_..."}
)

Exemple de réponse

Une réponse réelle de ce endpoint, capturée lors du dernier contrôle de santé.

{
    "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
}