Hi everybody, i have a question on the syntax for this :
servo.attach(pin, min, max)
i understand the first argument (it's the number of the pin that the servo is attached to) but then i don't understand the second and the third argument. When i see the helps here :
it told that :
min (optional): the pulse width, in microseconds, corresponding to the minimum (0-degree) angle on the servo (defaults to 544)
max (optional): the pulse width, in microseconds, corresponding to the maximum (180-degree) angle on the servo (defaults to 2400)
but i don't understand is it to set the velocity or something like this ?
That sets the timing for the servo.write() call. You can pass a setting in degrees, and the timing you pass in the attach function is used to determine what is 0 degrees and what is 180 degrees.
is it to set the velocity or something like this ?
No, it is to set the limits of movement for the servo.
A "standard" servo will be at 0 degrees with a signal of 1000 microseconds and at 180 degrees with a signal of 2000 microseconds. However, not all servos are equal so the min and max parameters allow you to adjust the end points.
Well, the min/max settings just set the upper and lower limits of the microsecond duration being sent to the servo. The degree values are just an abstraction/shell to somewhat equate to the possible rotation range of a hobby servo.