Go Down

Topic: Accel stepper library with support for 28byj-48 motor issue (Read 306 times) previous topic - next topic

New_coder

Hi kerimil, thanks for the new library. I seem to have a few problems with the library though. I want the stepper motor to move back to its original position after reaching the set position.
I used the code
Code: [Select]
#include <AccelStepper.h>
AccelStepper stepper3(5, 2, 3, 4, 5);  
void setup()
{  
    stepper3.setMaxSpeed(900.0);
    stepper3.setAcceleration(700.0);
    stepper3.moveTo(768);
    }

void loop()
{
    // Change direction at the limits
        if (stepper3.distanceToGo () == 0)
        stepper3.moveTo(1700);
       stepper3.run();
       stepper3.moveTo(0);
       stepper3.run();

    

}

 Unfortunately, it stops after  
Code: [Select]
   stepper3.moveTo(1700);
      stepper3.run();
Moreover, how can I convert the number 1700 to the number of revolutions, as I need exactly 5 revolutions for my project. Thanks, and sorry in advance if some of my questions are stupid...I'm new.

Robin2

You have re-awakened a 4-years dead Thread.

I have suggested to the Moderator to move your question to its own Thread.

...R
Two or three hours spent thinking and reading documentation solves most programming problems.

Go Up