playPositions()

Description

Plays user-defined robot motion frames.

Grammar

servoframe.playPositions()

servoframe.playPositions(servo1)

servoframe.playPositions(servo1, servo2)

servoframe.playPositions(servo1, servo2, ... , servo64)

 

servoframe.playPositions(time)

servoframe.playPositions(time, servo1)

servoframe.playPositions(time, servo1, servo2)

servoframe.playPositions(time, servo1, servo2, ... , servo64)

Parameters

servoframe: Variable of type AIServoFrame.

servo1 ~ servo64: Variables of type AIServo.

time (optional): The time it takes for the servo to reach the target position. If no value is entered or the value is 0, the servo 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

23

24

25

#include <AIServo86.h>

  

AIServoPort(ROBOTIS, AX12) bus;

AIServo myservo0;

AIServo myservo1;

AIServo myservo2;

AIServoFrame myframe; //Declare a Frame object

  

void setup()

{

  bus.begin(Serial1, 1000000);

 

  myservo0.attach(bus, 9);

  myservo1.attach(bus, 11);

  myservo2.attach(bus, 5);

 

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

  myframe.positions[1] = 1300;

  myframe.positions[2] = 2000;

  // Move the servo to the position specified by the Frame in 500ms (myservo0 moves to position[0]

  // position, myservo1 rotates to position[1], myservo2 rotates to position[2])

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

}

  

void loop() {}

See also

- positions[]
- setPostions()
- save()
- load()


Library Reference Home

The text in the 86Duino Reference is adapted from the Arduino Reference and is licensed under a Creative Commons Attribution-ShareAlike 3.0 License. The code examples in the reference have been released into the public domain.