aiservoMultiRun()

[AIServo86]

説明

Start multiple servos at the same time. After calling this function, the behavior of each servo is the same as the behavior of run().

Syntax

aiservoMultiRun()
aiservoMultiRun(servo1)
aiservoMultiRun(servo1, servo2)
aiservoMultiRun(servo1, servo2, ... , servo64)

Parameters

servo1 ~ servo64: Variables of AIServo type.

You can enter 1 to 64 servo-type parameters to specify the servo to be activated or enter no parameters; when no parameters are entered in this function, it means to activate all the servos that have been attached().

Returns

None.

Example

#include <AIServo86.h>
  
AIServoPort(ROBOTIS, AX12) bus;
AI Servo servo1;
AIServo servo2;
  
void setup()
{
   bus.begin(Serial1, 1000000);
   servo1.attach(bus, 6); servo2.attach(bus, 10); // use pin 6, 10
   servo1. setPosition(150);
   servo2.setPosition(150);
   aiservoMultiRun(servo1, servo2); // turn servo1, servo2 to the initial position
   delay(500);
}
  
void loop()
{
   servo1.setPosition(250, 2000);
   servo2.setPosition(50, 2000);
   aiservoMultiRun(servo1, servo2); // Make servo1 and servo2 rotate to the new target angle at the same time
   while(isAIServoMultiMoving() == true); // wait for all servos to move to target position
   servo1.setPosition(170, 2000);
   servo2.setPosition(160, 2000);
   aiservoMultiRun(); // Make servo1 and servo2 rotate to the new target angle at the same time
   while(isAIServoMultiMoving() == true); // wait for all servos to move to target position
}

See also


Libraries Reference Home

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

コメントする

上部へスクロール