AccelStepper moveTo() error

Hi everyone!!!
I using 28BYJ-48 – 5V Stepper Motor// Arduino Uno // AccelStepper
I dont know what is happening with moveTo, I tested it today with moveTo(2048) and it did not move as it should. I could see that it turned less than half one round, it turned such as 30º degrees, after it the motor started trembling, in the end it turned a little bit more. But now, Ive tried moveTo(9*2048) and the motor turned around perfectly.
My question is: Why does this happen? What to do when I got this error? How to prevent it?

#include <AccelStepper.h>   
AccelStepper Stepper (AccelStepper::FULL4WIRE, 8, 10, 9, 11);
unsigned long steps = 2048;
void setup() {
  Serial.begin(9600);
  Stepper.setMaxSpeed(1000);  
  Stepper.setAcceleration(1000);  
  Stepper.setSpeed(1000);
  Stepper.moveTo(9*steps);  
}

void loop() {
    Stepper.run();
}

Does the program compile without errors? I do not see a "moveTo() in the AccelStepper.h. There is a "RunTo().

Paul

yes, it runs, but in this crazy way that I told you :confused:

Have you tried to use the function Stepper.runToNewPosition(steps);?

I would put it in the loop() and take out the Stepper.moveTo(steps);

Take a look at the class functions AccelStepper: AccelStepper Class Reference it may spark some new ideas.

Try much lower acceleration.

If that does not work then also try a much lower step rate. If it works at a low speed you can then experiment with higher speeds.

...R

Paul_KD7HB:
Does the program compile without errors? I do not see a "moveTo() in the AccelStepper.h. There is a "RunTo().

Paul

AccelStepper definitely has moveTo(), runToPosition() and runToNewPosition(), but not runTo() or RunTo().

nrioux:
Have you tried to use the function Stepper.runToNewPosition(steps);?

I would put it in the loop() and take out the Stepper.moveTo(steps);

Take a look at the class functions AccelStepper: AccelStepper Class Reference it may spark some new ideas.

Thats a blocking call though, the whole advantage of AccelStepper is it can be used non-blocking....

MarkT:
Thats a blocking call though, the whole advantage of AccelStepper is it can be used non-blocking....

True, although it was just an idea to see if it works or not. I like using it at first to check everything is working.

So run some of the examples?

Experiment with values of MaxSpeed and Acceleration - motors have physical limits to performance
that need to be determined experimentally usually, as the load and damping have an effect.