Xiao ESP32S3 Servo is working in the setup but not in the loop. Help!

Hi!

I’m finishing the vers. 2 of a side project I’ve been dealing with since some time.

2 devices, bot with a pot and a a servo: with pot A you control Pot B, and vice versa, using mqtt.

Everything worsk fine, but now (close to the end) I’m noticing that the servo is not working anymore on both devices. I can’t tell from which iteration, I suspect is a timing issued caused by the use of several libraries.

I tried to move the servo in the loop(), but not success.

Do you have any advices?

Here is the code. I move the servo at this line, how do I make things a little more in synch?

Thanks in advance for your help

Hi there,

May be to large for the post limit or ? I went ahead and tried to post it for you so others may comment.
Which Servo are you using (link) any encoders?
After three posts you can post pictures , etc.
The MQTT, is the likely code in the way.
HTH
GL :slight_smile: PJ :v:

Everything is Seeed’s Grove stuff

I solved by declaring the pin with the D in front.
Apparently without the D, it was working in the setup() but not in the loop().
I haven’t had time to recreate this issue which is wuite interesting.

Thanks for commenting though

Hi there,

Yes I saw this : "// Servo and Potentiometer Management
static const int servoPin = 1; // servo pin
"
GOOD job.

GL :slight_smile: PJ :v: