How to slowly change direction of the stepper motor with AccelStepper? I know that direction can be changed with
.setSpeed(speed);
... //check input
.setSpeed(-speed);

I need to slowly decelerate and accelerate backwards, so I have to use
.setAcceleration(200);
...
.setMaxSpeed(speed);
... //check input
.setMaxSpeed(-speed);

but documentation told that .setMaxSpeed argument Must be &gt; 0.
So how to properly change direction with deceleration? Probably I have to use .moveTo with some very big values
I have tested it on real motor, and it works as I want with function .moveTo . Speed slowly changed from +maxSpeed to -maxSpeed acording to Acceleration
#define maxSpeed 1000
#define Acceleration 500
............
void setup(){  
  stepper.setMaxSpeed(maxSpeed);
  stepper.setAcceleration(Acceleration);
}
void loop() {
 ............
 if(bDirection!=bDirection_last)
 {
  stepper.moveTo(bDirection?6000000:-6000000);
  ...........
 }
 stepper.run();
}