Delay changing, making motors run longer

Is it possible for the delay to change, and how can I prevent this? I have an actuator motor that I run using the arduino nano. I control when to stop and start the motors using delay. Although, on some occasions, the motor run longer and make the gate that it is pushing go out of alignment. I was going to install micro-switches to stop it, although was it causing the delay to change? Using a h-bridge, I simply set one pin high to open, then low to stop wait 10 seconds, and set another pin high to close.

Do you have any feedback from your motors back to your arduino?

Without a feedback (like analog feedback servos) it's not easy to program your arduino to drive the motor rotating to a specific degree or for a specific period of time, it won't be accurate.

You need a limit switch on both ends of the swing.

Just using time will not be very accurate, since there are several un-calculated variables, such, and battery voltage, wind .

Post your code.

Also, you probably shouldn't be using delay().