AccelStepper Lib does not work anymore :(

hi!

i used the AccelStepper Library to drive a bipolar motor, and this code

#include <AccelStepper.h>
AccelStepper raStepper(AccelStepper::DRIVER,3,2); // pin 3 connected to STEP, pin 2 connected to DIR
//--------------------------------------------------------
void setup() {  
  raStepper.setMaxSpeed(2000); 
  raStepper.setAcceleration(1000); 
  raStepper.moveTo(1000000);
}
//---------------------------------------------------------
void loop() {  
  raStepper.run();
}

used to work fine. pin assignmets were not changed. now it is dead after downlaoding the latest version. what did i do wrong???

:confused:

yours
wolfi

Birki:
now it is dead

Please explain exactly what you mean by that.

Birki:
after downlaoding the latest version

The latest version of what?

Birki:
used to work fine

Which version were you using when it worked fine?

Have you verified that it goes back to the working state when you revert to using that version?

hi!
sorry for being so imprecise; the Arduino environment is 1.8.2 under Ubuntu 16.04 (it did not work with the Arduino IDE on the Raspian Stretch I have installed, too); I had an older version (from this april) where a sketch was still uploaded, and there to motor started to spin. now it doesn't after uploading this sketch - so far to the "not working" thing. the installed version of the AccelStepper library is 1.57 ...
yours
wolfi

It's still not clear to me what changed between the working and non-working state. A new version of the Arduino IDE? A new version of the AccelStepper library? A new version of the sketch?

Also you didn't answer this question:

pert:
Have you verified that it goes back to the working state when you revert to using that version?

By "that version" I mean the version you were using before updating to the "latest version" (of whatever it is you're talking about).

hi!
i think the major difference might be the version 1.55 vs. 1.57 of the accelstepper library, as far as i can tell ...
yours
wolfi

Install version 1.55 again and see if it starts working. I'm not saying you shouldn't get the latest version of the library working but you need to verify that updating the library version was the cause of the problem.

hi!
thanks, will do that :slight_smile:
yours
wolfgang

And then look at the differences between the versions - there will be something in the change list in the release notes in AccelStepper.h file if something changed incompatibly.

BTW just looking at the code for AccelStepper 1.19 which I have shows an obvious bug in the constructor
which calls enableOutputs() at constructor-call time, which is not correct. This means the library will only
work for top-level constructors if called late enough in the initialization process, which is fragile to say the
least.

Constructors should never assume anything in the system is ready to use except the instance variables it
is initializing. Anything else should be done in a begin() method.

Bit of a surprize this, I've never seen AccelStepper fail, but it looks like that's luck - everyone calls
pinMode explicitly on the output pins anyway?