stepper motor code

I'm using adafruit motor shield v2. and a dm8601 stepper drive . stepper motor is s 34hs59-5004s bipolar
5 amp step angle 1.80

need code to set rpms very slow 2 rpm

rotate cw from center 20 degrees
hold for 2 minutes
rotate cc to 20 degrees past center
hold for 2 minutes
loop every 5 minutes

(deleted)

  • A step angle of 1.8 degrees means 200 steps per revolution.
  • 2 RPM is 400 steps per minute or 6.666 steps per second or 0.15 seconds between steps.
  • The closest you can get to 20 degrees is 11 steps: 19.8 degrees.
  • What do you mean by "center"?

o degrees ccw and cw from that point

These links may help
Stepper Motor Basics
Simple Stepper Code

...R

karl2324:
o degrees ccw and cw from that point

You might want to consider a servo motor rather than a stepper motor. With a servo it understands where it is so all you have to do it tell it to move to a certain angle (usually between 0 and 180 degrees). With a stepper motor all it can do is turn x number of steps clockwise or counter clockwise. You have to organise a method of discovering where it is and returning to the correct starting point at startup.

Ian