i need help with accel stepper ,any help is appreciated!

Hi folks :slight_smile:
I currently have 28byj48 and the controller that that comes with it.
I am trying to use accelstepper to control this stepper motor

What i am trying to do is move the motor(two of them) simultaneously.
It need to move in a specific way provided by the code

For example:
Move stepper 1 10steps Clockwise, move stepper 2 300steps counter clock wise(simultaneous)
Move stepper 1 399steps counter clock wise, move stepper 2 50steps clock wise(simultaneous)
Move stepper 1 138steps counter clockwise, move stepper 2 40 steps counter clock wise(simultaneous)
.......

I also hope i can reduce the amount of code to minumum amoount and the code i am building will be incredibly long!

Well thats all for this question, any help is greatly appreciated!!

This motor can't be driven by AccelStepper without hardware modification.
Your motor is a unipolar motor while AccelStepper only supports bipolar stepper motors.

In this thread you will find some useful information where the OP had the same problem.

After having re-constructed the motors to bipolar you can use AccelStepper library to do what you intend.
Keep in mind that due to the 1:64 gear speed will be very slow.

rpt007:
This motor can't be driven by AccelStepper without hardware modification.

This isn't true, you can drive anything, just use the function interface:

void set_stepper_outputs (byte phase)
{
  switch (phase)
  {
  case 0:
    ...
    break ;
  case 1:
    ...
    break ;
  case 2:
    ...
    break ;
  case 3:
    ...
    break ;
  }
}

int pos = 0 ;
void forward ()
{
  pos ++ ;
  set_stepper_outputs (pos & 3) ;
}

void backward ()
{
  pos -- ;
  set_stepper_outputs (pos & 3) ;
}

AccelStepper stepper (forward, backward) ;

@MarkT:

But this isn't "plain" AccelStepper code ...
And a newbie (incl. me) wouldn't know without your example that and how it is possible.

I just read the code, its documented. You can hack the code if it doesn't do what you want too.

You shouldn't be using a library without checking the comments in the .h file anyway, it usually
points out important things you might need to know, such as limitations (for instance AccelStepper
is limited to about 4000 steps/second), and how to use each function.

Mark,

I did read the documentation. But when I started with the library my main goal was to get my project done, having only zero to little knowledge in programming.

Thus I concentrated in understanding and implementing what I understood and what I needed to get my project run. So it apparently slipped out of my memory that it is possible to hack/adjust the code; my apologize to have posted a wrong information.

@dovidu:

I found a thread with a modified AccelStepper library controlling your motors directly.
It apparently uses the function mode which MarkT was pointing to.

You will find the thread inc. the modified library here.