load()

描述

載入 RobovieMaker2 的 .txt 動作檔案裡指定的動作幀。

語法

myframe.load(filename, frame_name)

參數

myframeServoFrameVstone 型別的物件。

filename:由 RobovieMaker2 所儲存的 .txt 動作檔案名稱。注意:此函式只會到 SD 卡的根目錄下尋找動作檔案,假如您的 86Duino 沒有插入 SD 卡,或者 SD 卡中沒有指定檔案,則載入會失敗。

frame_name:動作幀的名稱(可在 RobovieMaker2 中查詢取得)。

回傳

true:檔案載入成功。 false:檔案載入失敗。

範例

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

#include <Servo86.h>

  

Servo myservo0;

Servo myservo1;

Servo myservo2;

ServoFrameVstone myframe; 

 

void setup()

{

  myservo0.attach(9);

  myservo1.attach(11);

  myservo2.attach(5);

 

  // 載入 vstone.txt 動作檔中的 "Frame 0"

  myframe.load("vstone.txt", "Frame 0");

 

  myframe.playPositions(myservo0, myservo1, myservo2); // 播放動作幀

}

  

void loop() {}

See also

- positions[]
- save()
- setPostions()


函式庫參考主頁面

86Duino 參考資料的文字內容修改自 Arduino 參考資料,並遵循知識共享署名-相同方式共享 3.0 授權。參考資料中的程式碼範例已發佈到公共領域。