Need help moving a MG995 QUICKLY from 0 to 180

I need to move a Tower Pro MG 995 QUICKLY from 0 to 180 without stepping one degree at a time. The code I tried doesn’t work, it steps 1 degree at a time. I need this to open the face mask of my Iron Man helmet. I have the MG 995 red wire connected to the 5V pin on the Arduino and the brown wire connected to the ground on the Arduino and the orange wire connected to pin -3 on the Arduino. The code is:

// Include the Servo library
#include <Servo.h>
// Declare the Servo pin
int servoPin = 3;
// Create a servo object
Servo Servo1;
void setup() {
// We need to attach the servo to the used pin number
Servo1.attach(servoPin);
}
void loop(){
// Make servo go to 0 degrees
Servo1.write(0);

delay (5000);
// Make servo go to 180 degrees
Servo1.write(180);
delay (5000);
}

Normally, you would wait until the servo is at 0 degrees, before sending a command to go to 180 degrees, but 5 seconds seems a bit silly.

Please use code tags when posting code.

Sorry, I'm a newbie to Arduino as well as this forum, so I don't know how to use code tags (yet). I used 5 second delays because while researching it I found someone say (in reply to a similar problem) that the motor didn't have time to move before the command came to move to the next position. Do you have any suggestions to solve my problem?

For hints on how to use this forum, including how to use code tags, please read the "How to use this forum" post, at the top of every section.

Do you have any suggestions to solve my problem?

Not sure what your problem actually is. But you could reduce the delay(5000) to something more reasonable, like delay(600). That is about how long it takes the Tower Pro MG995 to traverse 180 degrees.

I hope you are NOT attempting to power the servo from the 5V Arduino output, as that will cause serious problems. Instead, use a 4xAA battery pack, and connect all the grounds.

Actually, I was using the Arduino to power the motor because I tried using batteries and the motor didn’t move at all, but you just gave me the answer by telling me to connect all the grounds - that did the trick! Thanks!