playPositions()

Description

Sets the target position of a specified servo to the motion frame stored in the positions[] array, and simultaneously commands the servo to move. After calling playPositions() , your program can continue with other tasks while the servo movement process continues in the background. To check whether the servo has reached its target position, call isServoMultiMoving() .

Grammar

myframe.playPositions()
myframe.playPositions(servo0)
myframe.playPositions(servo0servo1)
myframe.playPositions(servo0servo1, ... , servo44)

myframe.playPositions(time)
myframe.playPositions(time, servo0)
myframe.playPositions(time, servo0servo1)
myframe.playPositions(time, servo0servo1, ... , servo44)

Parameters

myframe: Object of type ServoFrameVstone .

servo0 ~ servo44 (optional): Objects of type Servo; servo0 uses the value of positions[0], servo1 uses the value of positions[1], and so on.

time (optional): Specifies the time it takes for the servos to reach their target positions. If this value is not specified or is set to 0, the servos will rotate at full speed.

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

#include <Servo86.h>

  

Servo myservo0;

Servo myservo1;

Servo myservo2;

ServoFrameVstone myframe; //Declare a ServoFrameVstone object

  

void setup()

{

  myservo0.attach(9);

  myservo1.attach(11);

  myservo2.attach(5);

 

  myframe.positions[0] = 1800; //Set Frame content

  myframe.positions[1] = 1300;

  myframe.positions[2] = 2000;

 

  // Command all servos to rotate from their current position to the position specified by myframe in 500ms

  myframe.playPositions(500, myservo0, myservo1, myservo2);

}

  

void loop() {}

See also

- positions[]
-  setPostions()


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