AIServoFrameRobotis 建構子

描述

初始化 AIServoFrameRobotis 類別。

AIServoFrameRobotis 是繼承於 AIServoFrame 類別,您可以直接呼叫 AIServoFrame 類別裡面的函式成員,如 positions[]setPositions()playPositions()save() 來設定、儲存或播放 Frame。

語法


AIServoFrameRobotis myframe
AIServoFrameRobotis myframe(filename, motionname, step)

參數

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

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

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

範例

#include <AIServo86.h> 

AIServoPort(ROBOTIS, AX12) bus;
AIServo myservo0;
AIServo myservo1;
AIServo myservo2;
AIServoFrameRobotis myframe("test.mtn", "abc", 1); // 讀取 test.mtn 檔中 abc 的 Step 1

void setup() 
{ 
  bus.begin(Serial1, 1000000);
  myservo0.attach(bus, 21);
  myservo1.attach(bus, 23);
  myservo2.attach(bus, 25);
  myframe.playPositions(myservo0, myservo1, myservo2); // 播放動作
} 

void loop() {} 

See also

load()


函式庫參考主頁面

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.