ServoFrameInno.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.

Syntax

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)

Parameters

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

Returns

None.

Example

#include <Servo86.h>
  
Servo myservo0;
Servo myservo1;
Servo myservo2;
 
ServoFrameInno myframe; // declares a ServoFrameInno 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() {}

See also


Libraries Reference Home

86Duino のリファレンスのテキストは Arduino レファレンス を編集したもので、 Creative Commons Attribution-ShareAlike 3.0 License下でライセンスされています。リファレンス内のコードサンプルはパブリックドメインとして公開されています。

コメントする

上部へスクロール