Zum Inhalt springen
GET /v1/angle

Servo angle from a pulse width

Live testen

10 freie Calls pro Tag — keine Anmeldung, kein API-Key. Geht durchs oanor-Gateway.

Eigene Header (optional)
api.oanor.com/servo-api

Funktioniert. Hol dir einen API-Key und nutze sie in deinem Projekt.

API-Key holen

Code-Snippets

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

Beispiel-Response

Echte Antwort dieses Endpoints, erfasst beim letzten Health-Check.

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