AIServoFrame.playPositions()

[AIServo86]

描述

Play back user-defined robot action frames (Frame).

語法

servoframe.playPositions()
servoframe.playPositions(servo1)
servoframe.playPositions(servo1, servo2)
servoframe.playPositions(servo1, servo2, ... , servo64)

servoframe.playPositions(time)
servoframe.playPositions(time, servo1)
servoframe.playPositions(time, servo1, servo2)
servoframe.playPositions(time, servo1, servo2, ... , servo64)

參數

  • servoframe: Variable of AIServoFrame type.
  • servo1 ~ servo64: The variables of AIServo type.
  • time (optional): If no setting value is entered or the setting value is 0, it means the servo will rotate at full speed.

回傳

範例

#include <AIServo86.h>
  
AIServoPort(ROBOTIS, AX12) bus;
AIServo myservo0;
AIServo myservo1;
AIServo myservo2;
AIServoFrame myframe; // declare a Frame object
  
void setup()
{
   bus.begin(Serial1, 1000000);
 
   myservo0. attach(bus, 9);
   myservo1. attach(bus, 11);
   myservo2. attach(bus, 5);
 
   myframe.positions[0] = 1800; // set Frame content
   myframe. positions[1] = 1300;
   myframe. positions[2] = 2000;
   // Rotate the servo to the position specified by Frame in 500ms (myservo0 rotates to position[0]
   // position, myservo1 rotates to position[1], myservo2 rotates to position[2])
   myframe.playPositions(500, myservo0, myservo1, myservo2);
}
  
void loop() {}

參考


函式庫參考主頁面

86Duino 參考的文本是根據 Creative Commons Attribution-ShareAlike 3.0 License,部分文本是從 the Arduino reference 修改的。 參考中的代碼示例已發佈到公共領域。

發表評論

上部へスクロール