aiservoMultiStop()

Description

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

Grammar

aiservoMultiStop()
aiservoMultiStop(servo1)
aiservoMultiStop(servo1servo2)
aiservoMultiStop(servo1servo2, … , servo64)

Parameters

servo1 ~ servo64: Variable of type AIServo.

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

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

#include <AIServo86.h>

 

AIServoPort(ROBOTIS, AX12) bus;

AIServo servo0;

AIServo servo1;

 

void setup()

{

  bus.begin(Serial2, 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); // Move servo0 and servo1 to their new target positions

  delay(1000);

  aiservoMultiStop(servo0, servo1); // Stop all servos

  delay(3000); // Stop 3 seconds

  servo0.setPosition(150, 1800);

  servo1.setPosition(160, 1200);

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

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

}

See also

- attach()
- setPosition()
- run()
- aiservoMultiRun()
- 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.