setPosition()
Description
Sets the target angle of the servo.
Syntax
servo.setPosition(position)
servo.setPosition(position, time)
Parameters
servo
: A variable of type AIServo
.
position
: A floating-point number representing the target angle. For example, 90.0 indicates the target position in degrees, meaning the servo will be at 90 degrees.
time
(optional): The time it takes to reach the target angle. If no value is entered or the value is 0, the servo will rotate at its fastest speed.
Postback
None
Example
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
|
See also
- attach()
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.