Arduino & TB6560 3 Axis

Best Regard

I have a driver TB6560 3 Axis (See attached image) that works with the following code with arduino mega.

byte directionPin = 9;
byte stepPin = 8;
int numberOfSteps = 10000;
byte ledPin = 13;
int pulseWidthMicros = 10;  // microseconds
int microsbetweenSteps = 1; // milliseconds

void setup() { 

  Serial.begin(9600);
  Serial.println("Starting StepperTest");
  digitalWrite(ledPin, LOW);
  
  delay(2000);

  pinMode(directionPin, OUTPUT);
  pinMode(stepPin, OUTPUT);
  pinMode(ledPin, OUTPUT);
  
 
  digitalWrite(directionPin, HIGH);
  for(int n = 0; n < numberOfSteps; n++) {
    digitalWrite(stepPin, HIGH);
    delayMicroseconds(pulseWidthMicros); // this line is probably unnecessary
    digitalWrite(stepPin, LOW);
    
    delay(microsbetweenSteps);
    
    digitalWrite(ledPin, !digitalRead(ledPin));
  }
  
  delay(3000);
  
  digitalWrite(directionPin, LOW);
  for(int n = 0; n < numberOfSteps; n++) {
    digitalWrite(stepPin, HIGH);
    // delayMicroseconds(pulseWidthMicros); // probably not needed
    digitalWrite(stepPin, LOW);
    
    delay(microsbetweenSteps);
    
    digitalWrite(ledPin, !digitalRead(ledPin));
  }
}

void readPotentiometer() 
{
const byte potPin = A0;
int potValue;

potValue = analogRead(potPin);
  
}

void loop()
{ 
}

My question is, that serves this (pulseWidthMicros) and (microsbetweenSteps), if I put just the pin HIGH step in without delay I always advancing? or that refers to the motor stepper used?

Thank You

I'm sorry but I don't understand your question.

I don't think there is any need for the small delay between digitalWrite(stepPin, HIGH) and ...LOW) because the digitalWrite() function is slow enough to give an adequate pulse width. If your motor is NOT working properly you could uncomment the line with pulseWidthMicros to see if that improves matters.

The variable microsBetweenSteps governs the speed at which steps are sent to the motor.

...R