AIServo.run()

[AIServo86]

Description

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

The text of the 86Duino reference is a modification of the Arduino reference and is licensed under a Creative Commons Attribution-ShareAlike 3.0 License. Code samples in the reference are released into the public domain.

Leave a Comment

Scroll to Top