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

Added Support for ESP32-C3 #25

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

EinRainerZufall
Copy link

The changes were only tested on a XIAO-ESP32-C3.
This should solve problem #20 .

After some testing I found out that ledc only work down to 200Hz on the ESP32-C3.

I have also added the solution @h2zero in #18 for the bit deep

The changes were only tested on a XIAO-ESP32-C3.
This should solve problem RoboticsBrno#20.

After some testing I found out that ledc only work down to 200Hz on the ESP32-C3.
@mikaeltulldahl
Copy link
Contributor

Are there no way to support lower frequencies than 200 Hz on C3?

@JarekParal
Copy link
Member

JarekParal commented Aug 30, 2023

The library in v1.1.0 has a new parameter frequency which user can use in the attach(...) function and set it according to the ESP32 chip. Thank @mikaeltulldahl and his #23 PR.

Without that, we would need to add define for each new ESP32 chip, which is not such practical.

Now users can set the frequency like this:

Servo servo1;
const int servoPin = 4;
const int frequency = 200; // Hz

servo1.attach(
    servoPin, 
    Servo::CHANNEL_NOT_ATTACHED, 
    Servo::DEFAULT_MIN_ANGLE, 
    Servo::DEFAULT_MAX_ANGLE, 
    Servo::DEFAULT_MIN_PULSE_WIDTH_US, 
    Servo::DEFAULT_MAX_PULSE_WIDTH_US, 
    frequency
);

@EinRainerZufall Let me know if you are ok with this solution, and we can close this PR.

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

Successfully merging this pull request may close these issues.

None yet

3 participants