ServoFrameVstone 建構子

描述

初始化 ServoFrameVstone 類別。

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

語法


ServoFrameVstone myframe
ServoFrameVstone myframe(filename, frame_name)

參數

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

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

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

範例

#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()


函式庫參考主頁面

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.