Help with stepper motor project

Hi, i new at arduino programming and I and to finish my project.

What I want to do, is the stepper motor rotate CW 50 steps when I push a button and stop. When I release the button, the motor will rotate CCW 50 steps and stop again.
I'd like also control the speed.

Im only able to do the stepper rotates CW with no stop using serial monitor. =(

Thanks everyone.

Start small: try to learn to read from the pins first.

These links may help get you started
Stepper Motor Basics
Simple Stepper Code

If you need more help than post a link to the datasheet for your stepper motor and tell us what stepper motor driver you are using.

Your requirement suggests that you need to set the step count to 50 and FWD when the button changes from not-pushed to pushed and then count down the number of steps. And again set it to 50 and REV when it changes from pushed to not-pushed.

...R

Robin2:
These links may help get you started
Stepper Motor Basics
Simple Stepper Code

If you need more help than post a link to the datasheet for your stepper motor and tell us what stepper motor driver you are using.

Your requirement suggests that you need to set the step count to 50 and FWD when the button changes from not-pushed to pushed and then count down the number of steps. And again set it to 50 and REV when it changes from pushed to not-pushed.

...R

I don't have the datasheet of my stepper, but its a bipolar one and im using driver A4988.

I read your links, but as I sad, im new in programming.

im new in programming.

No one started as an expert.

What you want to do is trivial IF the hardware is all connected correctly.

Read the state of a pin. If it has changed (see the state change detection example), to pressed, do something. If it has changed to released, do something else.

Those somethings are stepping 50 times one way or the other. With the Stepper library, that is stupidly simple.

GiovaneM:
I don't have the datasheet of my stepper, but its a bipolar one and im using driver A4988.

Just because it is bipolar does not mean that an A4988 is suitable. The A4988 is really only suitable for motors that require less than about 1.3 to 1.5 amps. Some motors are designed for higher currents and if you use an A4988 and set the current at (say) 1.4 amps you may be "wasting" a lot of the capability of the motor.

On the other side, if the motor is only designed for (say) 0.35 amps and you set the A4988 for 1.4 amps then the motor will almost certainly be destroyed.

Use your multimeter to measure the resistance of the motor coils.

Does the motor work with my Simple Stepper Code? if not, get that working before trying anything else.

...R