load()

描述

载入由 save() 函式储存的动作帧档案。(载入完成后,使用者可在 positions[] 阵列中取得动作帧内容。)

语法


myframe.load(filename)

参数

myframeServoFrame 型别的物件。

filename:动作帧档案的名称。注意:此函式只会到 SD 卡的根目录下寻找动作帧档案,假如您的 86Duino 没有插入 SD 卡,或者 SD 卡中没有指定档案,则载入会失败。

回传

true:档案载入成功。
false:档案载入失败。

范例

#include <Servo86.h> 
 
Servo myservo1; 
Servo myservo2; 
Servo myservo3;
ServoFrame myframe;
 
void setup() 
{ 
  myservo1.attach(9); 
  myservo2.attach(11); 
  myservo3.attach(5);

  myframe.load("frm0.txt"); // 从指定档案载入机器人动作帧
  myframe.playPositions(500, myservo1, myservo2, myservo3); // 以 500 ms 的时间播放此动作帧
} 
 
void loop() {} 

See also

positions[]
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.