new user code help

just started using a uno to control a single servo, need a hand to get the programming done. would like to use a motion sensor to activate servo , have the servo move 90 degrees and stop, then use motion sensor to return servo 0 . and if possible add a momentary switch to do the same functions. i know its a pretty basic setup compared to some of the stuff ive seen on here , but we all start somewhere

The way things usually work here is that you post the code you’re having difficulty with (in code tags), and we help you fix it.

Try this Servos with Arduino

You may find some useful stuff in planning and implementing a program.

It will be much easier if you develop your program as series of separate parts and then connect them together. Your code in loop() might look like this

void loop() {
   readMotionSensor();
   readButtons();
   updateServoPosition();
}

...R