Can I control two servos simultaneously?

BenF

I agree a simple blocking solution it not nice. but a busy wait isn't great either :slight_smile:
There are several ways to solve these sorts of problem.

When Coretin gives a bit more detail, I'm confident that we can help find a good solution.

I'd add:

  1. if all Corentin wants to do is control two servo's, there isn't anything else to solve. Avoid "Premature Optimisation" :slight_smile:
    (Program optimization - Wikipedia)

  2. If the problem is elegantly represented as a data-driven 'script', it is practical to avoid blocking in the 'script player'.

  3. Your code example contains links to time intervals, or more correctly servo speed, too via the value of SERVO_SPEED. If the servos are different and move at different rates (which is quite common), the solution becomes more complex.

Anyway. I'll wait to hear from Corentin. You may have nailed it.
GB-)