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.

Syntax

servo.setVelocity(value)

Parameters

  • 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.

Returns

None.

Example

#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() {}

See also


Libraries Reference Home

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

コメントする

上部へスクロール