servoMultiPause()

[Servo86]

説明

Pause multiple servos at the same time. (This function acts like calling pause() for each specified servo.)

Syntax

servoMultiPause()
servoMultiPause(servo1)
servoMultiPause(servo1, servo2)
servoMultiPause(servo1, servo2, ... , servo45)

Parameters

  • servo1 ~ servo45: The variables of servo type.

You can input 1 to 45 servo type parameters to specify the servos to be rotated together, or you can not input any parameter, when no parameter is input, it means all the servos already attached() will be rotated at the same time.

Returns

None.

Example

#include <Servo86.h>
 
Servo servo0;
Servo servo1;
 
void setup()
{
   servo0.attach(6); servo1.attach(10);
   servo0.setPosition(1500);
   servo1.setPosition(1600);
   servoMultiRun(servo0, servo1); // turn servo0 and servo1 to the initial position together
}
 
void loop()
{
   servo0.setPosition(900, 2000);
   servo1.setPosition(2000, 2000);
   servoMultiRun(servo0, servo1); // make servo0, servo1 rotate to the new target position
   delay(1000);
   servoMultiPause(servo0, servo1); // Pause all servos
   delay(3000); // pause for 3 seconds
   servoMultiResume(servo0, servo1); // all servos resume rotation
   while(isServoMultiMoving() == true); // wait for all servos to go to the target position
   servo0.setPosition(1500, 2000);
   servo1.setPosition(1600, 2000);
   servoMultiRun(servo0, servo1); // make servo0, servo1 rotate to the new target position
   while(isServoMultiMoving() == true); // wait for all servos to go to the target position
}

See also


Libraries Reference Home

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

コメントする

上部へスクロール