Inverting direction pin for stepper driver

1,070 views
Skip to first unread message

Steven Brace

unread,
Apr 15, 2015, 7:13:05 AM4/15/15
to accels...@googlegroups.com
I am trying to invert the direction pin value sent to my driver, but am having trouble getting the setPinsInverted function working.

How is this function properly used with a driver?


#include <AccelStepper.h>

AccelStepper stepper(1, 3, 2); //stepper driver on pins 1 and 2
stepper.setPinsInverted (true,false,false);



Is this right?

Thanks

Steve

Steven Brace

unread,
Apr 15, 2015, 7:17:05 AM4/15/15
to accels...@googlegroups.com
I get this error:


other:48: error: 'class AccelStepper' has no member named 'setPinsInverted'

Mike McCauley

unread,
Apr 15, 2015, 11:44:19 AM4/15/15
to accels...@googlegroups.com
That's the right way to call it. Perhaps you do not have the AccelStepper library installed properly

Sent from my iPhone
--
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.

John Wall

unread,
Jul 22, 2016, 6:19:17 PM7/22/16
to accelstepper
I get the same error message that Steve was getting using the same code.  I have also tried several variations of it with no success.  

I have the Accel 1.47 library installed and all of the functions I have tried work fine with exception to the pin invert function.  

Can you help shed some light onto this problem.

Thanks 
John 

Mike McCauley

unread,
Jul 22, 2016, 8:04:06 PM7/22/16
to accels...@googlegroups.com
Hello,
Not without more information like sample code, board type and the exact error
message

FYI this code compiles fine here with the latest version

#include <AccelStepper.h>

// Define a stepper and the pins it will use
AccelStepper stepper(1, 3, 2);

void setup()
{
stepper.setPinsInverted (true,false,false);
// Change these to suit your stepper if you want
stepper.setMaxSpeed(100);
stepper.setAcceleration(20);
stepper.moveTo(500);
}

....

>
> Thanks
> John

--
Mike McCauley VK4AMM mi...@airspayce.com
Airspayce Pty Ltd 9 Bulbul Place Currumbin Waters QLD 4223 Australia
http://www.airspayce.com
Phone +61 7 5598-7474

John Wall

unread,
Jul 23, 2016, 11:17:13 AM7/23/16
to accelstepper
Thank you Mike.  You inadvertently provided the solution for me.  I was placing the "setPinsInverted" statement immediately after the statement that creates an instance of the stepper motor class.  Once I moved the "setPinsInverted " to "void setup()"  all was good and it compiled.

Thanks again
John
Reply all
Reply to author
Forward
0 new messages