Servo Movement

I’ve having some trouble, i want to get a servo to move just 90 degrees, slowly, back and forth. Every tutorial i’ve tried makes the servo go a full rotation, how can i change that?

. Every tutorial i've tried makes the servo go a full rotation, how can i change that?

R/C servos rarely make a full rotation - they have mechanical stops which prevent this.
What code have you been using?

im assuming you mean a real servo, not continuous?

look at the lines: #define time 15
#define PosGoal 90

// Sweep
// by BARRAGAN <http://barraganstudio.com> 
// This example code is in the public domain.


#include <Servo.h> 
 
Servo myservo;  // create servo object to control a servo 
                // a maximum of eight servo objects can be created 
 
int pos = 0;    // variable to store the servo position 
#define time 15 //CHANGE THIS for how fast the servo moves from pos to pos, in miliseconds
#define PosGoal 90 //change this to the angle you want to go to

void setup() 
{ 
  myservo.attach(9);  // attaches the servo on pin 9 to the servo object 
} 

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