Servo86.run()

[Servo86]

説明

Command the servo to rotate to the target position set by setPosition().

After calling run(), your program can do other things and the work of rotating the servo will be executed in the background. If you want to know whether the servo is rotating to the target position, you can call isMoving() or isServoMultiMoving() to check.

Please note that when the servo is in the disengaged state, this function will make the servo to come out of force immediately.

Syntax

servo.run()

Parameters

servo: Variable of the servo type.

Returns

None.

Example

#include <Servo86.h>
  
Servo myservo;
  
void setup()
{
   myservo.attach(9);
   myservo.setPosition(1500); // Set to rotate to 1500us angle at the fastest speed (the first rotation must be the fastest speed)
   myservo.run(); // turn the servo
   delay(1000); // stop at 1500us angle for about 1 second
   myservo.setPosition(1000, 1000); // set to 1000us angle, it takes 1 second
   myservo.run(); // turn the servo
}
  
void loop() {}

See also


Libraries Reference Home

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

コメントする

上部へスクロール