isAIServoMultiMoving()

[AIServo86]

Description

Check the status of multiple servos at the same time.

Syntax

isAIServoMultiMoving()
isAIServoMultiMoving(servo1)
isAIServoMultiMoving(servo1, servo2)
isAIServoMultiMoving(servo1, servo2, ... , servo64)

Parameters

servo1 ~ servo64: Variables of AIServo type.

You can enter 1 to 64 servo-type parameters, specify the servo to be activated, or enter no parameters; when no parameters are entered, it means checking the status of all servos.

Returns

If at least one servo is rotating, true is returned, and when all servos are paused, stopped, released, or have reached the target position, false is returned.

Example

#include <AIServo86.h>
 
AIServoPort(ROBOTIS, AX12) bus;
AI Servo servo1;
AIServo servo2;
  
void setup()
{
   bus.begin(Serial3, 1000000);
   servo1.attach(bus, 9); servo2.attach(bus, 10);
   servo1. setPosition(150);
   servo2.setPosition(150);
   aiservoMultiRun(servo1, servo2); // turn servo1, servo2 to 150 degrees
   delay(1000);
}
  
void loop()
{
   servo1.setPosition(280, 2000);
   servo2.setPosition(80, 2000);
   aiservoMultiRun(servo1, servo2); // Make servo1 and servo2 rotate to the new target angle at the same time
   while(isAIServoMultiMoving() == true); // wait for all servos to move to target position
   servo1.setPosition(170, 2000);
   servo2.setPosition(160, 2000);
   aiservoMultiRun(); // Make servo1 and servo2 rotate to the new target angle at the same time
   while(isAIServoMultiMoving() == true); // wait for all servos to move to 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