Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Frequency parameter is not working as expected #31

Open
reivaxy opened this issue Mar 20, 2024 · 3 comments
Open

Frequency parameter is not working as expected #31

reivaxy opened this issue Mar 20, 2024 · 3 comments

Comments

@reivaxy
Copy link

reivaxy commented Mar 20, 2024

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
Copy link
Author

reivaxy commented Mar 21, 2024

Also tested with frequencies 200 on pin1 and 400 Hz on pin2 and both pins show a 400 frequency.
If I reverse and set 400 on 1 and 200 on 2, both have a 200Hz signal: the last pin attached set the frequency for all.

@thijstriemstra
Copy link

what board are you using?

@reivaxy
Copy link
Author

reivaxy commented Apr 16, 2024

XIAO ESP32-S3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants