ServoFramePololu 建構子
描述
初始化 ServoFramePololu 類別。
ServoFramePololu 是繼承自 ServoFrame 類別,能載入用 Pololu 動作編輯器 Maestro Control Center 製作的機器人動作幀。
語法
ServoFramePololu myframe
ServoFramePololu myframe(filename, sequence_name, frame_name)
參數
filename:由 Maestro Control Center 所儲存的動作幀檔案名稱。
sequence_name:動作幀所屬的 Sequence 名稱(可在 Maestro Control Center 中查詢取得)。
frame_name:動作幀的名稱(可在 Maestro Control Center 中查詢取得)。
如果有輸入以上三個參數,則 ServoFramePololu 在初始化類別時,會自動載入該檔案內的指定動作幀做為初始動作幀。請注意,您必須將檔案放在 SD 卡根目錄下;假如您的 86Duino 沒有置入 SD 卡,或者 SD 卡內不包含動作幀檔案,則檔案載入會失敗。
範例
#include <Servo86.h>
Servo myservo0;
Servo myservo1;
Servo myservo2;
// 載入 Pololu 動作幀檔中 "Sequence 0" 的 "Frame 0"
ServoFramePololu myframe("mypololu.txt", "Sequence 0", "Frame 0");
void setup()
{
myservo0.attach(21);
myservo1.attach(23);
myservo2.attach(25);
myframe.playPositions(myservo0, myservo1, myservo2); // 播放動作幀
}
void loop() {}
See also
- load()
- setPostions()
The text of the 86Duino reference is licensed under a Creative Commons Attribution-ShareAlike 3.0 License. Code samples in the reference are released into the public domain.
