AIServoFrame 建構子
描述
初始化 AIServoFrame 類別。
語法
AIServoFrame myframe
AIServoFrame myframe(filename)
參數
filename
:檔案名稱。當有指定檔案名稱時,初始化 AIServoFrame 類別的過程中,會載入指定動作幀檔案。請注意,目前只支援從 SD 卡根目錄下載入檔案,假如您的 86Duino 上面沒有置入 SD 卡,或者 SD 卡中沒有指定的檔案,載入則會失敗。
範例
#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()
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.