Back

#pwm

1 APIs with this tag

RC Servo & PWM API

RC servo and PWM maths as an API, computed locally and deterministically — the pulse-width, angle and duty-cycle numbers a robotics, RC or embedded developer drives a servo with. The angle endpoint turns a pulse width into the servo angle: a hobby servo reads the width of the pulse (not a duty cycle), so the standard 1000–2000 µs maps linearly across the travel with 1500 µs at centre — angle = (pulse − min) ÷ the min-to-max span × the travel — and it flags when a pulse asks for more than the configured range so you do not drive the servo into its mechanical stops. The pulse endpoint runs it the other way, giving the pulse width a microcontroller should write for a target angle (90° is 1500 µs on a 1000–2000 µs / 180° servo), exactly what an Arduino-style servo library computes under the hood. The duty endpoint converts a pulse and a refresh frequency into the PWM period and duty cycle: a 50 Hz servo frame is 20 ms, so a 1500 µs pulse is just 7.5 % duty — the value a timer peripheral needs — and faster frames for digital servos or multirotor ESCs (e.g. 333 Hz) change it. Everything is computed locally and deterministically, so it is instant and private. Ideal for robotics and RC firmware, microcontroller and embedded tools, drone and animatronics projects, and maker calculators. Pure local computation — no key, no third-party service, instant. 3 compute endpoints. For stepper steps-per-mm use a stepper-motor API.

api.oanor.com/servo-api