isAIServoMultiMoving()

[AIServo86]

描述

Check the status of multiple servos at the same time.

語法

isAIServoMultiMoving()
isAIServoMultiMoving(servo1)
isAIServoMultiMoving(servo1, servo2)
isAIServoMultiMoving(servo1, servo2, ... , servo64)

參數

servo1 ~ servo64: Variables of AIServo type.

You can enter 1 to 64 servo-type parameters, specify the servo to be activated, or enter no parameters; when no parameters are entered, it means checking the status of all servos.

回傳

If at least one servo is rotating, true is returned, and when all servos are paused, stopped, released, or have reached the target position, false is returned.

範例

#include <AIServo86.h>
 
AIServoPort(ROBOTIS, AX12) bus;
AI Servo servo1;
AIServo servo2;
  
void setup()
{
   bus.begin(Serial3, 1000000);
   servo1.attach(bus, 9); servo2.attach(bus, 10);
   servo1. setPosition(150);
   servo2.setPosition(150);
   aiservoMultiRun(servo1, servo2); // turn servo1, servo2 to 150 degrees
   delay(1000);
}
  
void loop()
{
   servo1.setPosition(280, 2000);
   servo2.setPosition(80, 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
}

參考


函式庫參考主頁面

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

發表評論

上部へスクロール