AIServo.run()

[AIServo86]

説明

Start the servo (i.e., the servo starts to produce power).

If you have already called setPosition() to set the target angle, the servo will start to rotate to the angle you set.

Please note that since this function will make the servo start immediately, please avoid turning the servo by hand to avoid injury or damage to the servo.

Syntax

servo.run()

Parameters

servo: Variable of the AIServo type.

Returns

None.

Example

#include <AIServo86.h>
  
AIServoPort(ROBOTIS, AX12) bus;
AIServo myservo;
  
void setup()
{
   bus.begin(Serial3, 1000000);
   myservo. attach(bus, 3);
   myservo.setPosition(200); // Set to rotate to 200 degrees at the fastest speed
   myservo.run(); // turn the servo
   delay(1000);
   myservo.setPosition(100, 1000); // set to turn to 100 degrees, it takes 1 second
   myservo.run(); // start the servo
   while(myservo. isMoving());
}
  
void loop() {}

See also


Libraries Reference Home

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

コメントする

上部へスクロール