load()
描述
由 RobovieMaker2 產生的 .ini 動作設定檔裡,載入指定的伺服機偏移量微調值。
語法
myoffset.load(filename, offset_name)
參數
myoffset
:ServoOffsetVstone
型別的物件。
filename
:由 RobovieMaker2 所產生的 .ini 動作設定檔名稱。注意:此函式只會到 SD 卡的根目錄下尋找指定檔案,假如您的 86Duino 沒有插入 SD 卡,或者 SD 卡中沒有指定檔案,則載入會失敗。
offset_name
:RobovieMaker2 動作設定檔中的偏移量微調值(Offset)名稱(可在 RobovieMaker2 中查詢取得)。
回傳
true:檔案載入成功。
false:檔案載入失敗。
範例
#include <Servo86.h> Servo myservo0; Servo myservo1; Servo myservo2; ServoOffsetVstone myoffset; void setup() { myservo0.attach(9); myservo1.attach(11); myservo2.attach(5); // 從 SD 卡中的 vstone_offset.ini 設定檔裡載入名為 Offset 0 的偏移量微調值 myoffset.load("vstone_offset.ini", "Offset 0"); myoffset.setOffsets(myservo0, myservo1, myservo2); // 設定各伺服機的偏移量微調值 } void loop() {}
See also
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.