Combining a continuous rotation servo motor with PIR sensor

Hello again
I have a code, that makes the servo motor spin depending on the value the user inputs. Now I need to combine the PIR sensor with the rotation servo. PIR has to work as an on/off switch. When PIR detects motion it has to stop and when it detects motion again, it has to start spinning at the point that he ended, so if the servo is spinning 1600 then after turning back on it has to continue spinning 1600. The problem is, that I don't know how to combine them together. I would be very grateful is someone could help me with this.

Code for the moving servo:

#include <Servo.h>

Servo myservo;
int x=1500;
bool newSpeed = false;
int state = 0;
int state1 = 0;

void setup() 
{
  myservo.writeMicroseconds(1000);
  myservo.attach(9);
  Serial.begin(9600);
  Serial.println("Please enter a number and press ENTER.");
}

void loop() 
{
  readSerial();
  if (newSpeed) setSpeed();
}

void readSerial()
{
  if (Serial.available()>0)
  {
    x=Serial.parseInt();
    if (x>1600)
    {
      Serial.println("The speed value is too high");
    }
    else if (x<1400)
    {
      Serial.println("The speed value is too low");
    }
    else newSpeed=true;
  }
}

void setSpeed()
{
  Serial.print("Setting speed to: ");
  Serial.println(x);
  myservo.writeMicroseconds(x);
  newSpeed=false;
}