PIR Motion Sensor controlled Servo

Hey guys.
i'm pretty familiar with the concepts of Arduino micro controller, but i've just started using one for my final year of high school in Systems Engineering.
the project i'm making is a replica of the Team fortress 2 Level 2 Sentry gun.
i know some of the basics and I've been trying to write some simple code for the Arduino Uno SMD Rev3 on the Arduino 1.0.5 that would allow me to have a servo moving from 0-125 degrees and back on loop until a PIR sensor detects motion and causes the servo stop moving for 5 seconds and then resume back to the Servo movement loop.
I've tried to see if other people have been doing things similar but all i can find are people who make the servo move after motion is detected.
I've also looked into Interrupts or ISR (interrupt service routine) but they're a little complex for me at the moment and i'm wondering if this could be done
i have my unfinished and possibly completely whack code here

int Pir = 2;                                 //Pir sensor is Pin 2
#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 
                                       // Pin 2 has an Motion sensor connected
                                       // give it a name:

void setup() {                                     // the setup routine runs once when you press reset
  
  pinMode(PIR, INPUT);                             // initialize the digital pin as an output.
  myservo.attach(9);                               // attaches the servo on pin 9 to the servo object

}


void loop()                          // the loop routine runs over and over again forever
  {
  
  for(pos = 0; pos < 120; 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(25);                       // waits 25ms for the servo to reach the position 
  } 
  for(pos = 120; pos>=1; pos-=1)     // goes from 180 degrees to 0 degrees 
  {                                
    myservo.write(pos);              // tell servo to go to position in variable 'pos' 
    delay(25);                       // waits 25ms for the servo to reach the position 
  } 
  
{
  digitalRead(Pir);                  // Reads if PIR input is high or low
  if (Pir, HIGH);                    // If it Reads high
  digitalWrite (myservo, LOW);       //
  else
  
  for(pos = 0; pos < 120; 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(25);                       // waits 25ms for the servo to reach the position 
  } 
  for(pos = 120; pos>=1; pos-=1)     // goes from 180 degrees to 0 degrees 
  {                                
    myservo.write(pos);              // tell servo to go to position in variable 'pos' 
    delay(25);                       // waits 25ms for the servo to reach the position 
  } 
  
  }
}
  }

I know this code probably doesn't make much sense but if you can see what i'm trying to do that's great.
I was trying to make the servo move and then when motion was sensed to stop moving the servo.
if anyone could help me that'd be greatly appreciated
Thank you for your time
Tryndus

You need to ditch the delays and use millis() for timing. This would allow you to check the PIR input between servo movements. Look at the BlinkWithoutDelay example for inspiration.

You need something like this

set time of previous servo movement to now
start of loop
  read the PIR and if activated call the action() function
  is it time to move the servo yet ?
  if yes
    check the servo position and direction and move it appropriately
    save the time of the movement
  end of if
end of loop

action() function
  actions to be taken when the PIR detects movement
end of function

I'm not sure how to use millis exactly so i don't know how to incorporated it instead of delay.
i've put a LED in so it can signal if the the motion sensor is working and it seems to sense the motion but flicker lightly but the servo flickers in the one spot.
now that i've got the arduino using the PIR and Servo i need help to put it together and help me code the servo to move from 0 to 120 degrees and back and when the Motion sensor is triggered the Servo stops moving for 5 seconds.

my code so far:

void loop()                               // the loop routine runs over and over again forever
 {
  for(pos = 0; pos < 120; 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(25);                            // waits 25ms for the servo to reach the positio
   
    int sensor_1 = digitalRead(motion_1);    // the sensor detects variable motion  
    if (sensor_1 == HIGH)                    // if the motion sensor detects motion
     digitalWrite (light_1,HIGH);            // Turn LED on
     else (sensor_1 == LOW);                 // if sensor doesn't detect motion
     digitalWrite (light_1,LOW);             // keep LED off
     delay(25);
    
    for(pos = 120; pos>=1; pos-=1)     // goes from 180 degrees to 0 degrees 
  
    myservo.write(pos);              // tell servo to go to position in variable 'pos' 
    delay(25);

Have a look at BlinkWithoutDelay and see how the program determines whether it is time to change the state of the LED. This will show you how to use millis() for timing.

Basically, save the millis() time of the previous action(s) and keep checking until the current millis() minus the millis() value of the previous change exceeds the required interval. Once it does, then do some action(s), (turn an LED on or off, move a servo a few degrees, or whatever), save the time and do it all over again.