Towerpro sg90 min delay

Hi, I’m trying to control Towerpro SG90 servo. I’ve seen different codes, some of them use a loop to turn servo gradually by using delay in between steps like below:

for(servoAngle = 0; servoAngle < 180; servoAngle++) //move the micro servo from 0 degrees to 180 degrees
{
servo.write(servoAngle);
delay(15);
}

I wonder what could be the minimum delay to use? Can I go down to lower delays down to 1ms? If yes will it damage the output pin of arduino if I power directly from usb? Would it work if I power from 9V?

The reason is I know that if you use the command below, servo works really fast.
servo.write(45); // Turn SG90 servo Left to 45 degrees

servo.write(45);

This does move the servo to the commanded position as fast as the servo can go.

Your loop has this line which also moves the servo to the commanded position as fast as the servo can go

servo.write(servoAngle);

but then it waits for a small period of time, giving the result of slower average movement.

Yes, you can change that small period of time to any valid value, including zero. Different delay values will result in different average movement speeds. Experiment with different values to see the results.

How would this damage the output pin?
Oh, are you powering the servo from the 5v pin? Don't do that. Servos pull too much current and will quickly cause you problems. Use a separate power source for the servo, not the 5v pin from the arduino.

DO NOT power the servo from Arduino, use separate power (9V,2A)

make sure there is common ground between Arduino and servo

and, you should put longer delays(x); if your servo is driving something that needs 'big torque'

i have MG-996 servo driving 3/4" ball valve, with shafts directly coupled,
delay(200); works better so far , for 90 angle turn, in 5 seconds

KASSIMSAMJI:
DO NOT power the servo from Arduino, use separate power (9V,2A)

No, do NOT power an SG90 with 9V. You will kill it. 5V or 6V fine but no more.

Steve