Changing servo library PWM frequency?

I found that photons uses the same servo library as arduino and it has a slow refresh rate at 50 Hz, which was the norm for old analog servos. Servo signal had 1-2ms pulse duration and 20ms period (that gives 50Hz). But new drone ESC’s and digital servos accept close to 500hz refresh rate. The period is now used is close to 2ms (2.22ms to get 450hz)
Could somebody provide me a faster servo library or help me to modify the one we have?


I found this line: #define SERVO_TIM_PWM_FREQ 50//50Hz in "pinmap_hal.h"
Is that the line where the fixed servo PWM is defined or is it done somewhere else?
Would changing the value form 50 to 450 make any difference or brake something?
It Would be awesome if somebody could help me to add a paramater to the sevo library where we could change PWM frequncy

1 Like

Thi is great! Hope you can figure this out.

How would you modify a built in library?

To modify the Servo library, please submit a pull request with the code changes needed.