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.