ServoFrameKondo.playPositions()

[Servo86]

描述

Set the target position of the specified servo to the action frame content stored in the positions[] array, and command the servo to rotate.

After calling playPositions(), your program can go to do other things, and the work of rotating the servo will be executed in the background. If you want to know whether the servo is rotating to the target position, you can call isServoMultiMoving() to check.

語法

myframe.playPositions()
myframe.playPositions(servo0)
myframe.playPositions(servo0, servo1)
myframe.playPositions(servo0, servo1, ... , servo44)

myframe.playPositions(time)
myframe.playPositions(time, servo0)
myframe.playPositions(time, servo0, servo1)
myframe.playPositions(time, servo0, servo1, ... , servo44)

參數

  • myframe: the object of ServoFrameKondo type.
  • servo0 ~ servo44 (optional): Servo type object; servo0 uses the value of positions[0], servo1 uses the value of positions[1], and so on.
  • time (optional): If this value is not set, or if it is set to 0, the servo will rotate at full speed.

回傳

範例

#include <Servo86.h>
  
Servo myservo0;
Servo myservo1;
Servo myservo2;
ServoFrameKondo myframe; // declares a ServoFrameKondo object
  
void setup()
{
   myservo0.attach(9);
   myservo1.attach(11);
   myservo2.attach(5);
 
   myframe.positions[0] = 1800; // set the frame content
   myframe.positions[1] = 1300;
   myframe.positions[2] = 2000;
 
   // Command all servos to rotate from the current position to the position specified by myframe in 500ms
   myframe.playPositions(500, myservo0 , myservo1, myservo2);
}
  
void loop() {}

參考


函式庫參考主頁面

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

發表評論

上部へスクロール