Hello MicroController, your idea seems very interesting to me and I am going to try your code, but I don't think it is the best option to achieve my goal.MicroController wrote: ↑Tue Sep 26, 2023 8:40 pmIndeed, it's not. It's an alternative suggestion on how to control any number of servos simultaneously from a single dedicated task. One or more other tasks or ISRs can asynchronously give "commands" to the servos by calling startServoMove() and all servos will move at the same time, each at its own prescribed speed until it stops at its target position or receives another command.it is not the idea that I have to move each servo in an independent task that runs on each core
An approach like this is more efficient than creating one task per servo and scales to more servos than you have PWM channels with virtually no increment in RAM or CPU use.
But I may also have misunderstood the actual issue.
I will try to explain myself better, I have a servo tower made https://es.aliexpress.com/item/33002852 ... Redirect=yup of two servomotors, one makes the horizontal movement and the other vertical. The tower moves a laser that is projected onto a surface to describe a trajectory.
I have a task that controls a microphone, to send a notification to the task or tasks through an interruption (if there are two tasks, it sends it first to one and then to the other) so I can activate the laser and start the movement of the laser tower with the voice.
The positions to define the movement of the servos are already defined in an array previously.
I can now make very fluid and precise movements, by improving the algorithm and trying different servo motors, but I have always made the movement from the same task, first moving the horizontal servo and then the vertical one. Furthermore, the task that controls the microphone and the one that makes the movement are tied to different cores, and this is precisely what I would like to take advantage of....the SMP and use both cores of an ESP32 so that each core moves a servo.
Since I only have two servos and the use of resources is not a problem, I use two tasks anchored to a different core each.
I'm already writing the code, let's see if I finish it soon and can test it.
Thank you very much, if you have any suggestions or clarifications, I am very grateful.