Stepper motor activations from PIR

I need to activate a stepper motor from PIR to do an action, THEN wait for a new input from same PIR to do another action with the stepper motor.

Second action needs to WAIT for input, so the first must complete first.

So how to get the loop to remain idle while it waits for the second input?

Your contribution would be appreciated.

how are you notified by your PIR that something has happened? interrupt? do you poll the PIR status?

loop() should always be checking for everything, the phrase

how to get the loop to remain idle while it waits for the second input?

Doesn't make sense - its constantly checking for everything, it is never "idle".

You need state-handling for your sequencing of stuff, so that the right checks are
done in the relevant states.

LJBos:
I need to activate a stepper motor from PIR to do an action, THEN wait for a new input from same PIR to do another action with the stepper motor.

When the PIR is detected you should change a variable - say pirDetected = true;

Then your motor function can be something like this

void myMotorFunction() {
  if (pirDetected == true) {
     // do stuff
     pirDetected = false;
}

...R

guess it depends what the OP wants to do - constant activity from servo while there is something maintaining the PIR triggered (beside the delay) or if needs to do something once and then wait for a new PIR activation

for the sake of clarity - I'd probably recommend to call the variable PirActionNeeded to reflect the intent

Many PIR sensors tend to stay HIGH for a long time even after the triggering event has happened. So when the PIR is triggered PirActionNeeded is set to true and either handled in one go as a function call like Robin suggests or maintained to true in an approach à la "blink without delay". Once the action from the PIR is done, then PirActionNeeded is set to false and code needs to wait for PIR to go untriggered before doing the action again possibly...

J-M-L:
for the sake of clarity - I'd probably recommend to call the variable PirActionNeeded to reflect the intent

Good idea.

...R