What I undestand, myservo.write(pos) is used to move the servo to de position you want (in degrees).
I think there isnt any specific instruction to modify velicity, but you can do something like this:
int pv = 0; //present value i recomend u to set servo on 'home' position and then set pv there
int sp = 90; //set point, the position you want to go
int step_delay = 10; //step delay, time betwen degree and degree
if(pv < sp) { //positive direction
while (pv < sp) {
myservo.write(++pv); //first increase pv and then write position to servo
delay(step_delay);
}
} else { //negative direction
while (pv > sp) {
myservo.write(--pv); //first decrease pv and then write position to servo
delay(step_delay);
}
}
That just an example and i haven't tried, then maybe have some buggs.
What the others are suggesting is that you gradually approach the new position, not Leap from A to B, then from B to A.
There are many ways to do this, maybe look in the Servo example for "sweep" for hints to try.
Then search this forum and elsewhere for "non blocking delay" to learn about the pitfalls of the delay() function.
C
in general this is exactly how a "Blink without delay" is done.
In other words - get rid of all your delays.
delay = BLOCK
you don't want to BLOCK your code.
There are also other libraries than Servo.h, that allow to set the speed of the servo. E.g. the MoToServo class of my MobaTools library is widely compatible to the Servo.h ( same methods ), but allows you to set the speed of the servo by a simple call to 'myservo.setSpeed(speed)'
You must take into accout, that the methods like 'write' are also not blocking - like the Servo.h calls. So the servo moves, while your sketch moves on. There are special methods to check when the servo has reached its target position ( or where it is positioned at the moment )
how to use libraries
I got the impression from your original post that you wanted to learn the former, not necessarily the latter. The latter will no doubt address the need to "make the servo go slower", but will teach you very little about "how to code a slower approach".
YMMV, it's all good!
C