Help Need - PWM Servo Control with ESP32-S2

BivvyCoder
Posts: 10
Joined: Sun Jan 28, 2024 5:20 pm

Help Need - PWM Servo Control with ESP32-S2

Postby BivvyCoder » Tue Jun 11, 2024 2:49 pm

I'm doing some development with an ESP32-S2 dev board and have been asked to add a servo motor.
I've tried the mcpwm_servo_control example in the IDE but can't get it to compile, for instance I get an error
  • MCPWM_TIMER_CLK_SRC_DEFAULT undeclared
The code has the motor control PWM library included

Code: Select all

#include "driver/mcpwm_prelude.h"
If I change the target to ESP32-C3 it compiles fine (and looking at the Readme file, the S2 is not listed as supported, so I guess I shouldn't be surprised.)

Two questions.
  • If it is, can anyone point me at an example that I can test and then use to develop my own application?
Many thanks

ESP_Sprite
Posts: 9618
Joined: Thu Nov 26, 2015 4:08 am

Re: Help Need - PWM Servo Control with ESP32-S2

Postby ESP_Sprite » Wed Jun 12, 2024 1:00 am

You may be able to use the LEDC peripheral instead.

BivvyCoder
Posts: 10
Joined: Sun Jan 28, 2024 5:20 pm

Re: Help Need - PWM Servo Control with ESP32-S2

Postby BivvyCoder » Tue Jul 09, 2024 1:19 pm

That's great - thanks
Managed to use LEDC to create the required PWM signals

Who is online

Users browsing this forum: No registered users and 90 guests