aiservoMultiPause()

Description

Pauses multiple servos simultaneously. After calling this function, the behavior of each servo is the same as calling pause().

Syntax

aiservoMultiPause()
aiservoMultiPause(servo1)
aiservoMultiPause(servo1servo2)
aiservoMultiPause(servo1servo2, … , servo64)

Parameters

servo1 ~ servo64: Variables of type AIServo.

You can enter 1 to 64 AIServo-type parameters to specify the servos to start, or leave them blank. If no parameters are entered, all running servos will be paused.

Postback

None

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

28

29

30

31

32

#include <AIServo86.h>

 

AIServoPort(ROBOTIS, AX12) bus;

AIServo servo0;

AIServo servo1;

 

void setup()

{

  bus.begin(Serial1, 1000000);

  servo0.attach(bus, 6);

  servo1.attach(bus, 10);

  servo0.setPosition(150);

  servo1.setPosition(160);

  aiservoMultiRun(servo0, servo1); //Start servo0, servo1 servers

  delay(500);

}

 

void loop()

{

  servo0.setPosition(90, 2000);

  servo1.setPosition(200, 2000);

  aiservoMultiRun(servo0, servo1); // Rotate servo0 and servo1 to the new target position

  delay(1000);

  aiservoMultiPause(servo0, servo1); // Pause all servos

  delay(3000); // Pause for 3 seconds

  aiservoMultiResume(servo0, servo1); // All servos resume movement

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

  servo0.setPosition(150, 2000);

  servo1.setPosition(160, 2000);

  aiservoMultiRun(servo0, servo1); // Move servo0 and servo1 to the new target position

  while(isAIServoMultiMoving() == true); // Wait for all servos to reach the target position

}

See also

- attach()
- setPosition()
- run()
- aiservoMultiRun()
- aiservoMultiResume()
- isAIServoMultiMoving()


Library 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.