bunogenrinho:
I'm only using a step motor, the arduino and the button plug in arduino
bunogenrinho:
It means that the button has 2 wires and one is at pin 2 and the other is connected at GND
Then your code is wrong, since when the button is pressed digitalRead() will return LOW, not HIGH.
Just declare the pin mode thus:
pinMode(buttonPin, INPUT_PULLUP);
and change your button press logic to:
// check if the pushbutton is pressed. If it is, the buttonState is LOW:
if (! buttonState) // use negation operator, much less cumbersome
Using the internal pullups like this is possible only if the button switches to ground.