load()

描述

載入 RoboPlus Motion 編輯器產生的 .mtn Frame 檔案。

語法

aiservoframerobotis.load(filename, motionname, step)

參數

aiservoframerobotisAIServoFrameRobotis 型別的變數。

filename:RoboPlus Motion 編輯器產生的 .mtn 檔案名稱。請注意,目前只支援從 SD 卡根目錄下載入檔案,假如您的 86Duino 上面沒有置入 SD 卡,或者 SD 卡中沒有指定的檔案,載入則會失敗。

motionname:欲載入 .mtn 檔案中的 Motion 名稱。

framename:欲讀取的 Motion 之 Step 數目。

回傳

true:檔案載入成功。 false:檔案載入失敗。

範例

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

#include <AIServo86.h>

  

AIServoPort(ROBOTIS, AX12) bus;

AIServo myservo0;

AIServo myservo1;

AIServo myservo2;

AIServoFrameRobotis myframe;  

 

void setup()

{

  bus.begin(Serial1, 1000000);

  myservo0.attach(bus, 9);

  myservo1.attach(bus, 11);

  myservo2.attach(bus, 5);

  // 讀取 Pololu Frame 檔中 Sequence  0 的 Frame 0

  myframe.load("test.mtn", "abc", 1);

  myframe.playPositions(myservo0, myservo1, myservo2); // 播放動作

}

  

void loop() {}

See also

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


 

函式庫參考主頁面

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