ESP-S2 PWM for a Servo pulse

StuartsProjects
Posts: 12
Joined: Sat Nov 28, 2020 11:05 am

ESP-S2 PWM for a Servo pulse

Postby StuartsProjects » Mon Apr 12, 2021 5:51 pm

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.

lbernstone
Posts: 635
Joined: Mon Jul 22, 2019 3:20 pm

Re: ESP-S2 PWM for a Servo pulse

Postby lbernstone » Mon Apr 12, 2021 6:55 pm

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.

StuartsProjects
Posts: 12
Joined: Sat Nov 28, 2020 11:05 am

Re: ESP-S2 PWM for a Servo pulse

Postby StuartsProjects » Tue Apr 13, 2021 7:47 am

Thanks, I submitted it as an issue;

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

Who is online

Users browsing this forum: No registered users and 52 guests