I know that direction can be changed with

... //check input

I need to slowly decelerate and accelerate backwards, so I have to use

... //check input

but documentation told that .setMaxSpeed argument Must be > 0.

So how to properly change direction with deceleration? Probably I have to use .moveTo with some very big values

  • have you looked at the example code that is included with the library? – jsotola Oct 4 '20 at 21:25
  • The library defines speed as steps per second. It doesn't care about the direction the steps are in. Just like you can't get out of a speeding tickets by always driving in reverse ;-). – Gerben Oct 5 '20 at 15:37

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(){  
void loop() {

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.