playPositions()

描述

播放用户自定义的机器人动作帧(Frame)。

语法

servoframe.playPositions()

servoframe.playPositions(servo1)

servoframe.playPositions(servo1, servo2)

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

 

servoframe.playPositions(时间)

servoframe.playPositions(time, servo1)

servoframe.playPositions(时间, servo1, servo2)

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

参数

servoframeAIServoFrame型其他变数。

servo1 ~servo64AIServo型其他变数。

时间 0,代表从机将以全速转动。

回传

范例

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

  

AIServoPort(ROBOTIS, AX12) 总线;

AIServo myservo0;

AIServo myservo1;

AIServo myservo2;

AIServoFrame myframe; // 声明一个 Frame 对象

  

void setup()

{

  bus.begin(Serial1, 1000000);

 

  myservo0.attach(bus, 9);

  myservo1.attach(bus, 11);

  myservo2.attach(bus, 5);

 

  myframe.positions[0] = 1800; //设置框架内容

  myframe.positions[1] = 1300;

  myframe.positions[2] = 2000;

  //以 500ms 的时间将伺服机转动到 Frame 指定的位置 (myservo0 转动到位置[0]

  // 位置,myservo1 转动到位置[1]位置,myservo2 转动到位置[2]位置)

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

}

  

void loop() {

See also

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


函式库参考主页面

86Duino 參考資料中的文字修改自 Arduino 參考資料,並根據 知識共享署名-許可證方式共享 3.0 授權相同。參考資料中的程式碼範例已發佈到公共領域。