isServoMultiMoving()

[Servo86]

Description

Check if all the servos have been rotated to the target position.

Syntax

isServoMultiMoving()
isServoMultiMoving(servo1)
isServoMultiMoving(servo1, servo2)
isServoMultiMoving(servo1, servo2, ... , servo45)

Parameters

  • servo1 ~ servo45: Variable of servo type.

You can enter 1 to 45 servo type parameters to specify the servos to be checked. You can also enter no parameters, and when no parameters are entered, it means all operating servos are to be checked.

Returns

If at least one servo is still rotating, then return true; when all the specified servos have reached the target position, or are in pause, stop, or release, then return false.

Example

#include <Servo86.h>
  
Servo servo1;
Servo servo2;
  
void setup()
{
   servo1.attach(6); servo2.attach(10); // use pins 6, 10
   servo1.setPosition(1500);
   servo2.setPosition(1500);
   servoMultiRun(servo1, servo2); // turn servo1 and servo2 to the initial position together
}
  
void loop()
{
   servo1.setPosition(2000, 2000);
   servo2.setPosition(1800, 2000);
   servoMultiRun(servo1, servo2); // make servo1 and servo2 rotate to the new target angle at the same time
   while(isServoMultiMoving() == true); // wait for all servos to go to the target position
   servo1.setPosition(1700, 2000);
   servo2.setPosition(1600, 2000);
   servoMultiRun(); // Make servo1 and servo2 rotate to the new target angle at the same time
   while(isServoMultiMoving() == true); // wait for all servos to go to the target position
}

See also


Libraries Reference Home

The text of the 86Duino reference is a modification of the Arduino reference and is licensed under a Creative Commons Attribution-ShareAlike 3.0 License. Code samples in the reference are released into the public domain.

Leave a Comment

Scroll to Top