aiservoMultiStop()

[AIServo86]

描述

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

語法

aiservoMultiStop()
aiservoMultiStop(servo1)
aiservoMultiStop(servo1, servo2)
aiservoMultiStop(servo1, servo2, ... , servo64)

參數

servo1 ~ servo64: Variables of AIServo type.

You can enter 1 to 64 parameters of AIServo type, specify the servo to be started, or enter no parameter; when no parameter is entered, it means to stop all servos.

回傳

範例

#include <AIServo86.h>
 
AIServoPort(ROBOTIS, AX12) bus;
AIServo servo0;
AI Servo servo1;
 
void setup()
{
   bus.begin(Serial2, 1000000);
   servo0. attach(bus, 6);
   servo1. attach(bus, 10);
   servo0.setPosition(150);
   servo1.setPosition(160);
   aiservoMultiRun(servo0, servo1); // start servo0, servo1 servos
   delay(500);
}
 
void loop()
{
   servo0.setPosition(90, 2000);
   servo1.setPosition(200, 2000);
   aiservoMultiRun(servo0, servo1); // make servo0, servo1 rotate to the new target position
   delay(1000);
   aiservoMultiStop(servo0, servo1); // stop all servos
   delay(3000); // stop for 3 seconds
   servo0.setPosition(150, 1800);
   servo1.setPosition(160, 1200);
   aiservoMultiRun(servo0, servo1); // make servo0, servo1 rotate to the new target position
   while(isAIServoMultiMoving() == true); // wait for all servos to go to target position
}

參考


函式庫參考主頁面

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

發表評論

上部へスクロール