[AIServo86]
Description
Set the target angle of the servo.
Syntax
servo.setPosition(position)
servo.setPosition(position, time)
Parameters
servo
: The variable of AIServo type.position
: The target angle of the floating-point number type, e.g., 90.0, the target position is in “degrees”, i.e., 90 degrees of the servo.time
(optional): If there is no input value or the input value is 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.setPosition(150); // Set to rotate to 150 degrees at the fastest speed myservo.run(); // turn the servo myservo.setPosition(100, 1000); // set to turn to 100 degrees, it takes 1 second myservo.run(); // turn the servo } 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.