load()

描述

RobovieMaker2 产生的 .ini 动作设定档裡,载入指定的伺服机偏移量微调值。

语法


myoffset.load(filename, offset_name)

参数

myoffsetServoOffsetVstone 型别的物件。

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

offsets[]
save()


函式库参考主页面

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.