run()

Description

Starts the servo (i.e., the servo begins to generate power). If you have previously called setPosition() to set a target angle, the servo will begin to rotate to the set angle. Note that since this function immediately generates power, avoid manually rotating the servo to avoid injury or damage.

Syntax

servo.run()

Parameters

servo: A variable of type AIServo.

Postback

None

Example

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

#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(); // Rotate the servo

  delay(1000);

  myservo.setPosition(100, 1000); // Set to rotate to 100 degrees, taking 1 second Seconds

  myservo.run(); //Start the server

  while(myservo.isMoving());

}

  

void loop() {}

See also

- attach()
- setPosition()


Library Reference Home

Text in the 86Duino reference material is adapted from the Arduino reference material and is licensed under the Creative Commons Attribution-Share Alike 3.0 License. The code examples in the reference materials have been released into the public domain.