AIServoOffset 建構子
描述
初始化 AIServoOffset 類別。
語法
AIServoOffset myoffset
AIServoOffset myoffset(filename)
參數
filename
:檔案名稱。當有指定檔案名稱時,初始化 ServoOffset 類別的過程中,會載入指定伺服機微調值檔案。請注意,目前只支援從 SD 卡根目錄下載入檔案,假如您的 86Duino 上面沒有置入 SD 卡,或者 SD 卡中沒有指定的檔案,載入則會失敗。
範例
#include <AIServo86.h> AIServoPort(ROBOTIS, AX12) bus; AIServo myservo1; AIServo myservo2; AIServo myservo3; AIServoOffset myoffset("offset.txt"); // 從 SD 卡中載入名稱為 offset.txt 伺服機微調值檔案 void setup() { bus.begin(Serial1, 1000000); myservo1.attach(bus, 1); myservo2.attach(bus, 3); myservo3.attach(bus, 5); myoffset.setOffsets(); myservo1.setPosition(100); myservo2.setPosition(150); myservo3.setPosition(200); aiservoMultiRun(); } void loop() {}
See also
- offsets[]
- setOffsets()
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.