AIServoFrame 建构子

描述

初始化 AIServoFrame 类别。

语法

AIServoFrame myframe

AIServoFrame myframe(filename)

参数

filename:档案名称。当有指定档案名称时,初始化 AIServoFrame 类别的过程中,会载入指定动作帧档案。

请注意,目前只支援从 SD 卡根目录下载入档案,假如您的 86Duino 上面没有置入 SD 卡,或者 SD 卡中没有指定的档案,载入则会失败。

范例

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 myservo1;

AIServo myservo2;

AIServo myservo3;

AIServoFrame myframe("frame.txt"); // 从 SD 卡中载入档案名称为 frame.txt 的动作帧

 

void setup()

{

  bus.begin(Serial1, 1000000);

 

  myservo1.attach(bus, 1);

  myservo1.attach(bus, 3);

  myservo1.attach(bus, 5);

   

  myframe.positions[0] = 150;

  myframe.positions[1] = 180;

  myframe.positions[2] = 200;

 

  myframe.setPositions();

  aiservoMultiRun();

}

 

void loop() {}

See also

- positions[]
- setPositions()


函式库参考主页面

86Duino 参考资料中的文字修改自 Arduino 参考资料,并根据 知识共享署名-许可证方式共享 3.0 授权相同。参考资料中的程式码范例已发布到公共领域。