sweep back after reaching position

Hello there,

I want to make the servo2 go back to 180 degrees with a delay of 5 seconds if the button is pressed from 90 degrees, does someone know how i can manage this?
thanks

 if (servoState == 1){
  pos2 = 180;
  }
else{
  pos2= 90;
//after button is pressed 5 second delay position goes back to 180
  }

You need to post all your code. You use the servo libiary, study the examples at Servo - Arduino Reference

We need to determine how the servo got to 90-degrees,
or how to detect the finger came in at a 90-degree angle to press the button.

if the button is pressed from 90 degrees