Go Down

Topic: Arduino Step and Direction controller code (Read 574 times) previous topic - next topic



I just wanted to post a piece of code that took some work and i hope is useful.

It is a command-driven step-and-direction controller. I used it to send commands from c# to drive a Schneider MDrive or two.

The hardest part was the READ to get it reliable. It should be now, it takes care of a timing issue.

The Parser figures out what command was sent. Writing what each command does is then pretty easy if you follow some of the existing commands. It has the basics like MOVE ABSOLUTE and RELATIVE.

Happy Motoring!



Jul 29, 2015, 12:50 pm Last Edit: Jul 29, 2015, 01:03 pm by Robin2
Thank you for sharing.

You may wish to look at serial input basics - simple, reliable, non-blocking and no timing issues

Can you post a link to the Schneider MDrive datasheet. I'm sure others will be interested.

I'm not sure how you are controlling the speed of the motor. If it is just using delay() or delayMicroseconds() I would suggest you use use millis() or micros() as illustrated in the second example in this simple stepper code

Stepper Motor Basics
Two or three hours spent thinking and reading documentation solves most programming problems.

Go Up