Hi,
I am new to Arduino Environment and wanted to get some help with my project.
First of all about my project:
I am using Arduino Uno to drive multiple stepper motors, say around 4 NEMA 17 motors.
I am using the DRV2285 driver module which requires STEP and DIR pin from Arduino.
I know the basics of the stepper motor but my project requires some complicated stuff.
I don't want any particular code, I just want to understand the concept so that I can write code myself.
So my concern is as follows:
As I want is to drive multiple stepper motors I can't use the delay function as it would drive one stepper at a time, but I want all to drive them simultaneously at different speeds and different intervals. So I did some googling and found out about MILLIS() function. I tried writing code using that but I am unsuccessful.
As you know to drive a stepper motor we drive STEP Pin high and low(ie. give pulse) with some interval between them. The code is as follows:
digitalWrite(stepPin, HIGH);
delayMicroseconds(300);
digitalWrite(stepPin, LOW);
delayMicroseconds(300);
So I am unable to figure out how to implement this using millis() function? Please explain to me with some examples.
Also, I don't know Object-oriented programming that much but I have seen people creating classes for basic stepper movement and then call out in the main loop? How to do that, please help me in layman's terms I am new to this.
I am attaching a photo that roughly gives the idea of how will the steppers moving simultaneously.
Any help would be appreciated. Thanks