Servo programming

Uploaded the sample program for running my servo back and forth but make various changes like rotating slow, then running faster, stopping for several seconds etc.
all I can do so far is change the degree of rotation and speed.
I would like to add several lines of code for the servo to go through the motions that I want and I did do that but it’s ignoring everything after the sample code. It does not respond to any changes.
I’m sure this is easy but I’m still learning.

Thanks so much

It is very difficult to help with code that we cannot see.

Read the forum guidelines to see how to properly post code.

It sounds like you are using the Servo->Sweep example:

void loop() {
  for (pos = 0; pos <= 180; pos += 1) { // goes from 0 degrees to 180 degrees
    // in steps of 1 degree
    myservo.write(pos);              // tell servo to go to position in variable 'pos'
    delay(15);                       // waits 15ms for the servo to reach the position
  }
  for (pos = 180; pos >= 0; pos -= 1) { // goes from 180 degrees to 0 degrees
    myservo.write(pos);              // tell servo to go to position in variable 'pos'
    delay(15);                       // waits 15ms for the servo to reach the position
  }
}

Where do you add the “several lines” and what do they say?

Note: If you have made any syntax errors in your “several lines” the compile of your sketch will not complete and your sketch will not upload. Do you get any error messages?