ServoFrameVstone 建構子

描述

初始化 ServoFrameVstone 類別。 ServoFrameVstone 是繼承自 ServoFrame 類別,能載入用 RobovieMaker2 動作編輯器製作的機器人動作幀。

語法

ServoFrameVstone myframe
ServoFrameVstone myframe(filename, frame_name)

參數

filename:由 RobovieMaker2 所儲存 .txt 動作檔案名稱。

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

如果有輸入以上兩個參數,則 ServoFrameVstone 在初始化類別時,會自動載入該檔案內的指定動作幀做為初始動作幀。請注意,您必須將檔案放在 SD 卡根目錄下;假如您的 86Duino 沒有置入 SD 卡,或者 SD 卡內不包含動作檔案,則檔案載入會失敗。

範例

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

#include <Servo86.h>

 

Servo myservo0;

Servo myservo1;

Servo myservo2;

 

// 從 SD 卡中載入 vstone_motion.txt 動作檔中的 "Frame 0"

ServoFrameVstone myframe("vstone_motion.txt", "Frame 0");

 

void setup()

{

  myservo0.attach(21);

  myservo1.attach(23);

  myservo2.attach(25);

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

}

 

void loop() {}

See also

- load()
- setPositions()


函式庫參考主頁面

86Duino 參考資料中的文字採用 知識共享署名-相同方式共享 3.0 授權授權。參考資料中的程式碼範例已發佈到公共領域。