[Servo86]
Description
Set the rotation speed of the servo when write() and run() are called next time.
Please note that if you set the rotation time when you call setPosition(), the rotation speed set by this function will not have any effect.
Syntax
servo.setVelocity(value)
Parameters
servo
: The variable of Servo type.value
: The speed of the servo, integer and floating point type values can be entered. When inputting an integer, the unit of rotation speed is us/s, for example, input 1000, which means 1000us of rotation per second. When a floating point number is entered, the unit of rotation speed is angle/s. For example, if 1.5 is entered, it means 1.5 degrees per second. If the input value is 0 or 0.0, it means the servo will rotate at the fastest speed.
Returns
None.
Example
#include <Servo86.h> Servo myservo; void setup() { myservo.attach(9); myservo.write(1500); // Rotate the servo to 1500us angle myservo.setVelocity(1000); // set velocity 1000us/s myservo.write(900); // start the servo and turn to the 900us angle with a speed of 1000us/s } 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.