AIServo.setVelocity()

[AIServo86]

描述

Set the rotation speed of the servo.

Note that this function is only valid if the rotation time has not been set. If you have already called setPosition() to set the rotation time, the rotation speed set by this function will not have any effect.

語法

servo.setVelocity(value)

參數

  • servo: Variable of AIServo type.
  • value: If the set speed exceeds the limit of the servo, the servo will rotate at the fastest speed. If the value is 0 or 0.0, it means the servo will rotate at the fastest speed.

回傳

範例

#include <AIServo86.h>
  
AIServoPort(ROBOTIS, AX12) bus;
AIServo myservo;
  
void setup()
{
   bus.begin(Serial1, 1000000);
   myservo. attach(bus, 9);
   myservo.write(150); // turn the servo to 150 degrees
   myservo.setVelocity(100); // set velocity to 100 degrees/second
   myservo.write(90); // Start the servo, turn it to 90 degrees at 100 degrees/second
}
  
void loop() {}

參考


函式庫參考主頁面

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

發表評論

上部へスクロール