unwanted program repetition

Hello.

I am sorry for my bad English.

I'm putting an automatic wire cutter. And the code I tested on the Un is working smoothly. But for arduin nano, the program repeats itself indefinitely. You do not know what a problem might be.

Use parts:
16x2 lcd
I2c lcd converter
5x button
A4988 stepper driver
nema 17
futaba 3003 servo
geekcreit arduino nano
non-soldering field

I did more to solve the non-soldering fields. Because I thought there might be a problem in contacts, but the problem still persists. Below I'm adding the source code.

wire cutter code

thank you in advance for the answers

Please post your code here

At the programming level, the Uno and Nano (Atmega328p) are nearly identical.
The ‘standard’ Nano bootloader is bigger that of the Uno and sometimes incompatible with the watchdog timer, which could cause repeated system restarts.

At the electrical level, the nano 3.3v can be weak, especially on some clones.

Anyway, as already said, post your code. A wiring diagram would also help.

The source code is in the original post

What's in the Original Post is a link to PasteBin, not your program code.

...R

Off-topic, but its nice to see a newbie who knows to use properly-named constants for pin assignments.

It can also be worthwhile to use symbolic constants for your states, although in a sketch like this which just runs through a sequence, numbers might make more sense.

An important concept that I don't see in your sketch is the idea that to control something with buttons, you don't check "is the button down" but rather you check "has the button gone from being up to being down". Doing this means that you don't need those delays all over the place. As it is, your sketch relies on people hitting the buttons exactly within the time frame that your delays provide.

Is the program looping or is the Nano resetting because of a power problem? Please post a wiring diagram.
HowToPost