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;
}
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...