How to change default pin location for 4 wire stepper

2,254 views
Skip to first unread message

larz250sx

unread,
Apr 12, 2017, 8:26:22 PM4/12/17
to accelstepper
Hello,
I made a mistake with wiring and soldering my motor driver to pins 8,9,10,11.... I was looking at an old electrical drawing... the accelstepper default pin locations are 2,3,4,5... is there any way to advoid redoing the soldering on the shield and just changing the default pin set up in the code?

gregor christandl

unread,
Apr 13, 2017, 1:30:43 AM4/13/17
to accelstepper
Hi, 
Use AccelStepper stepper(8,9,10,11); instead of the default constructor.

larz250sx <larz200...@gmail.com> schrieb am Do., 13. Apr. 2017, 02:26:
Hello,
I made a mistake with wiring and soldering my motor driver to pins 8,9,10,11.... I was looking at an old electrical drawing... the accelstepper default pin locations are 2,3,4,5... is there any way to advoid redoing the soldering on the shield and just changing the default pin set up in the code?

--
You received this message because you are subscribed to the Google Groups "accelstepper" group.
To unsubscribe from this group and stop receiving emails from it, send an email to accelstepper...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

gregor

unread,
Apr 13, 2017, 1:35:44 AM4/13/17
to accelstepper
Actually, the constructor call is 
AccelStepper stepper(AccelStepper::FULL4WIRE, 8, 9, 10, 11);

larz250sx

unread,
Apr 13, 2017, 5:28:01 AM4/13/17
to accelstepper
I will give that a shot, thank you!

larz250sx

unread,
Apr 13, 2017, 5:52:17 PM4/13/17
to accelstepper
Hello,
I tried that constructor call and I am getting an error saying 

"State_Machine:5: error: 'FULL4WIRE' is not a member of 'AccelStepper'

 AccelStepper stepper (AccelStepper::FULL4WIRE, 8, 9, 10, 11); // Defaults to 4 pins on 2, 3, 4, 5

                       ^

exit status 1
'FULL4WIRE' is not a member of 'AccelStepper'

larz250sx

unread,
Apr 13, 2017, 5:57:08 PM4/13/17
to accelstepper
I tried putting this in


AccelStepper::AccelStepper(uint8_t interface = AccelStepper::FULL4WIRE,
uint8_t pin1 = 8,
uint8_t pin2 = 9,
uint8_t pin3 = 10,
uint8_t pin4 = 11,
bool enable = true 
)



Still no luck, same error " FULL4WIRE not a member of AccelStepper"






On Thursday, April 13, 2017 at 1:35:44 AM UTC-4, gregor wrote:

gregor

unread,
Apr 13, 2017, 6:05:05 PM4/13/17
to accelstepper
hi, 
this works for me (used it today to debug my stepper motor wiring)
#include <AccelStepper.h>

// Define a stepper and the pins it will use
AccelStepper stepper(AccelStepper::FULL4WIRE, 8, 9, 10, 11);

void setup()
{  
  stepper.setMaxSpeed(100);
  stepper.setAcceleration(100);
  stepper.moveTo(200);
}

void loop()
{
  if (stepper.distanceToGo() == 0)
  {
    stepper.moveTo(-stepper.currentPosition());
  }
  stepper.run();
}

what version of the library are you using? check the header of the AccelStepper.h file, the last entry of the changelog is the version number. mine is 1.57 - the latest version available through the Arduino IDE's library manager.

larz250sx

unread,
Apr 13, 2017, 7:27:23 PM4/13/17
to accelstepper
How do i find out which version i am using? I just copied your code and it came up error FULL4WIRE is not a member of accelstepper

larz250sx

unread,
Apr 13, 2017, 7:34:54 PM4/13/17
to accelstepper
Version 1.2




On Thursday, April 13, 2017 at 6:05:05 PM UTC-4, gregor wrote:

larz250sx

unread,
Apr 13, 2017, 8:00:16 PM4/13/17
to accelstepper
Thanks for your help
I updated to 1.57 and tried the constructor call change
Compiles!!! 
Thanks again and Have a great day!


On Thursday, April 13, 2017 at 6:05:05 PM UTC-4, gregor wrote:

gregor

unread,
Apr 14, 2017, 2:35:36 AM4/14/17
to accelstepper
you're welcome :)
Reply all
Reply to author
Forward
0 new messages