I want to use cnc shield v3.0 and driver drv8825 to run a stepper motor. So I used this code. but i cannot control speed of stepper. i mean I want to use a command such as myStepper.setSpeed(motorSpeed) to control stepper speed. I don't know how create an object from Stepper class in this case and what pins will be used in object argument. please help.
Thanks a lot
but i cannot control speed of stepper.
The speed of the stepper is controlled by the interval between steps. Longer intervals == slower speed.
i mean I want to use a command such as myStepper.setSpeed(motorSpeed) to control stepper speed.
Then, you need to create an instance of some class that has a setSpeed() method, called myStepper (although that is a pretty dumb name. Who else's stepper would it be?).
I don't know how create an object from Stepper class in this case
Why not? The Stepper library comes with examples.
and what pins will be used in object argument.
The ones that the stepper driver board are connected to. You do have a stepper driver board, right?
The standard Stepper library is not really suitable for a stepper driver that takes step and direction inputs - like the DRV8825. Have a look at the AccelStepper library which is a lot more comprehensive.
You should be able to test your motor with this Simple Stepper Code which does not need any library. If you can’t get it to work you need to make a drawing showing how everything is connected and post a photo of the drawing.
Also, post a link to the datasheet for your stepper motor.
And tell us what power supply (volts and amps) you are using for the motor.
Stepper Motor Basics