Page 1 of 1

ESP-S2 PWM for a Servo pulse

Posted: Mon Apr 12, 2021 5:51 pm
by StuartsProjects
Is there an equivalent, for the ESP32-S2, to this command for a ESP32;

ledcSetup(PWMChannel, PWMFreq, PWMResolution);

Where PWMFreq would be the frequency\rate of the PWM pulse, which for a mecahnical servo you would normally set to 50hz.

The command above does work, I get a pulse and can vary the width correctly as needed, but the frequency of the pulse is way wrong, a value of 50 for PWMFreq gives a pulse frequency of around 5khz, and a value of 1, gives a pulse frequency of circa 300hz.

Re: ESP-S2 PWM for a Servo pulse

Posted: Mon Apr 12, 2021 6:55 pm
by lbernstone
Please submit issues with the code at https://github.com/espressif/arduino-esp32/issues so they can be fixed. This forum is for more general questions. Note that ledcSetup should return the frequency it set, so you can verify.

Re: ESP-S2 PWM for a Servo pulse

Posted: Tue Apr 13, 2021 7:47 am
by StuartsProjects
Thanks, I submitted it as an issue;

https://github.com/espressif/arduino-esp32/issues/5050