How to start a sketch from the beginning on power up

Hello,

I have a panel with multiple servos.
A 220v PIR detector powers up and shuts down the power
to the Arduino and all the servos.

When I upload my code the sketch works fine.
i.e. sets all servos to their zero position and goes on
with different patterns of servo movement.

Then the PIR detector, not sensing movement for 3 minutes, shuts power off.
When the detector senses movement and powers up the panel again my sketch
does not start from the beginning but it starts were it was left on power shut down.

How do I resolve this problem?

Would a soft rest code work for me ? If yes How do I implement it ?

Appreciate your help.

Arduino sketches do start from the beginning at Arduino power up....

Let's see the code?

(Meantime, put a serial print somewhere in setup(), open the monitor, let the pir do its thing, and see if the Arduino prints on the monitor at "power up")

Ah wait, that won't work as a test, since with the Arduino connected to the PC for the monitor, it will remain powered up if its other power supply goes off...

But have an led go on at the top of setup(), short delay, then turn it off. If the led blinks, then the Arduino restarted.

I will try the LED solution but I'm sure Arduino does not start.

I know that because my code :

void setup
{

MySweep();  // sweep all servos one time
}

void loop {

// do la lot of stuff
// move servos in different patterns
}

Sweeps all servos the first time I load the sketch.
But, when power is shut down and turned back on, MySweep function will not execute.

Yes, the panel is a stand alone and not attached to a PC.

If you are truly powering up the Arduino after is was powered down, it WILL absolutely start from the beginning o the program. If it does not, then it was NOW powered down. Period. End of story.

Regards,
Ray L.

Ray you are absolutely right, my bad.
Arduino was not powered down due to wiring error.
It works fine now.

Thank you all for your help.