Hello all,
I recently purchased a TB6600 Stepper Motor driver to use for my Arduino to power a NEMA 17 Stepper motor. https://www.amazon.com/MYSWEETY-TB6600-Stepper-Driver-Controller/dp/B01MYMK1G9
My questions concern a little more about the programming. I used a video course and the internet to help me create this particular sketch to run the motor.
For this motor, it is running the maximum speed that I am setting it to, but I need it to run for a total of 48 revolutions. In this script, I declared 6400 pulses/rev in my for statement, but I need it to run (640048) times even though it exceeds the overflow limit when I upload the script to the Arduino. Can anyone help me with how to solve this problem or if anyone has knowledge with this particular driver who could help at all?
This is what I need to achieve: for (unsigned int i=0; __i<(640048)__; i++)
In other words, I want the stepper motor to run 48 full revolutions at a rate of 6400 pulse/rev.
int PUL=6; //define Pulse pin
int DIR=5; //define Direction pin
int ENA=7; //define Enable Pin
void setup() {
pinMode (PUL, OUTPUT);
pinMode (DIR, OUTPUT);
pinMode (ENA, OUTPUT);
}
void loop() {
for (unsigned int i=0; i<(6400); i++) {
digitalWrite(DIR,LOW);
digitalWrite(ENA,HIGH);
digitalWrite(PUL,HIGH);
delayMicroseconds(3);
digitalWrite(PUL,LOW);
delayMicroseconds(3);
}
delay(1000);
for (unsigned int i=0; i<6400; i++)
{
digitalWrite(DIR,HIGH);
digitalWrite(ENA,HIGH);
digitalWrite(PUL,HIGH);
delayMicroseconds(3);
digitalWrite(PUL,LOW);
delayMicroseconds(3);
}
delay(1000);
while(1);
}