load()
描述
從指定的檔案中載入機器人的 AIServos 偏移量(即讀取檔案中的 AIServo 偏移量,然後載入 offsets[] 陣列)。
語法
servooffset.load(filename)
參數
servooffset
:AIServoOffset
型別的變數。
filename
:檔案的名稱。請注意,目前只支援從 SD 卡根目錄下載入檔案,假如您的 86Duino 上面沒有置入 SD 卡,或者 SD 卡中沒有指定的檔案,載入則會失敗。
回傳
true:檔案載入成功。
false:檔案載入失敗。
範例
#include <AIServo86.h> AIServoPort(ROBOTIS, AX12) bus; AIServo myservo0; AIServo myservo1; AIServo myservo2; AIServoOffset myoffset; void setup() { bus.begin(Serial1, 1000000); myservo0.attach(bus, 9); myservo1.attach(bus, 11); myservo2.attach(bus, 5); myoffset.load("offset0.txt"); // 從指定的檔案載入機器人動作微調值 myoffset.setOffsets(myservo0, myservo1, myservo2); // 設定機器人動作微調值 } void loop() {}
See also
- offsets[]
- setoffsets()
- 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.