isAIServoMultiMoving()

Description

Simultaneously check the status of multiple servers.

Grammar

isAIServoMultiMoving()
isAIServoMultiMoving(servo1)
isAIServoMultiMoving(servo1servo2)
isAIServoMultiMoving(servo1servo2, … , servo64)

Parameters

servo1 ~ servo64: Variable of type AIServo.

You can enter 1 to 64 Servo type parameters to specify the servos to start, or enter no parameters. If no parameters are entered, the status of all servos will be checked.

Return

Returns true if at least one servo is running. Returns false if all servos are paused, stopped, released, or have reached their target position.

Example

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

#include <AIServo86.h>

 

AIServoPort(ROBOTIS, AX12) bus;

AIServo servo1;

AIServo servo2;

  

void setup()

{

  bus.begin(Serial3, 1000000);

  servo1.attach(bus, 9); ser​vo2.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); // Move servo1 and servo2 to the new target angle simultaneously

  while(isAIServoMultiMoving()  == true); // Wait until all servos have reached their target positions

  servo1.setPosition(170, 2000);

  servo2.setPosition(160, 2000);

  aiservoMultiRun(); // Move servo1 and servo2 simultaneously to the new target angle

  while(isAIServoMultiMoving()  == true); // Wait until all servos reach their target positions

}

See also

– attach()
– setPosition()
– run()
– servoMultiRun()


Library Reference Page

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.