ServoESP32 icon indicating copy to clipboard operation
ServoESP32 copied to clipboard

Frequency parameter is not working as expected

Open reivaxy opened this issue 3 months ago • 1 comments

Hi and thanks for this library.

It seems like the frequency parameter that can be passed to the attach function is not actually changing the frequency but the pulse width. I have initialized two Servos like this:

  myservo1.attach(servoPin1, Servo::CHANNEL_NOT_ATTACHED, Servo::DEFAULT_MIN_ANGLE,
            Servo::DEFAULT_MAX_ANGLE, Servo::DEFAULT_MIN_PULSE_WIDTH_US,
            Servo::DEFAULT_MAX_PULSE_WIDTH_US, 200);

  myservo2.attach(servoPin2);

Here are signals measured on two pins, the first (yellow) one was set at 200Hz, and the second (blue) one was left at default value which is 50Hz And both signals are actually at 50Hz image

Here is what is expected: the yellow signal has a frequency 4 times higher: image

reivaxy avatar Mar 20 '24 19:03 reivaxy