Code for a door opener

Hello, like many, I am very new to Arduino. I am building yet another type of door opener, a style of which I could not find anywhere else on this site. There is a PIR mounted on either side of a door and when motion is detected, a continuously rotating servo attached to a gearbox will rotate a swing arm and push off the frame to open the door. I would like it to then pause for 10 seconds, and then the arm needs to rotate back to its original position. The code I wrote is below, it doesn't work correctly as it does not pause or switch rotation directions after a pause.

#include <Servo.h>

Servo myservo;
int pos = 0;
const int inputPin = 2;

void setup()
{
pinMode(inputPin, INPUT);
myservo.attach(9);
}

void loop(){
int val = digitalRead(inputPin);
if (val == HIGH)
{
for(pos = 0; pos < 180; pos += 1)
{
myservo.write(pos);
delay(15);
}
for(pos = 180; pos >=1; pos -= 1)
{
myservo.write(pos);
delay(15);
}
}
}

Please advise me on how to clean up the code
Thanks.

Go back, modify that post, select the code and hit the # icon and save.

I would like it to then pause for 10 seconds,

So put in a delay between the first and second for loop. Ten seconds would be delay(10000);

it does not pause or switch rotation directions

If you have a continuous rotation servo all you are doing is changing the speed not changing the direction. I am not sure it will work but try inputting a negative number.
Also as it it is continuous rotating you don't need the for() loops anyway, unless this is for acceleration.