load()
描述
載入 RoboPlus Motion 編輯器產生的 .mtn Frame 檔案。
語法
aiservoframerobotis.load(filename, motionname, step)
參數
aiservoframerobotis
:AIServoFrameRobotis
型別的變數。
filename
:RoboPlus Motion 編輯器產生的 .mtn 檔案名稱。請注意,目前只支援從 SD 卡根目錄下載入檔案,假如您的 86Duino 上面沒有置入 SD 卡,或者 SD 卡中沒有指定的檔案,載入則會失敗。
motionname
:欲載入 .mtn 檔案中的 Motion 名稱。
framename
:欲讀取的 Motion 之 Step 數目。
回傳
true:檔案載入成功。
false:檔案載入失敗。
範例
#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()
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.