Arduino Forum

Development => Other Software Development => Topic started by: New_coder on Apr 07, 2019, 03:07 pm

Title: Accel stepper library with support for 28byj-48 motor issue
Post by: New_coder on Apr 07, 2019, 03:07 pm
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.
Title: Re: Accel stepper library with support for 28byj-48 motor issue
Post by: Robin2 on Apr 07, 2019, 03:19 pm
You have re-awakened a 4-years dead Thread (https://forum.arduino.cc/index.php?reportsent;topic=194671).

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

...R