I want to be able to drive a bipolar stepper with a l2393d
I also want to use the stepper library build into the arduino IDE(I think)
However I don't want the function to be blocking so I want to be able to interface with the arduino whilst steps are occuring. I was just looking into the stepper.cpp files and I am a little confused with the follow syntax:
void Stepper::setSpeed(long whatSpeed)
{
this->step_delay = 60L * 1000L * 1000L / this->number_of_steps / whatSpeed;
}
to drive the stepper motor there needs to be a certain stepper delay (as far as I know) so I was just wondering if someone could explain the this-> syntax to me as I am not familiar with it.
if (this->pin_count == 4) {
switch (thisStep) {
case 0: // 1010
digitalWrite(motor_pin_1, HIGH);
digitalWrite(motor_pin_2, LOW);
digitalWrite(motor_pin_3, HIGH);
digitalWrite(motor_pin_4, LOW);
break;
case 1: // 0110
digitalWrite(motor_pin_1, LOW);
digitalWrite(motor_pin_2, HIGH);
digitalWrite(motor_pin_3, HIGH);
digitalWrite(motor_pin_4, LOW);
break;
case 2: //0101
digitalWrite(motor_pin_1, LOW);
digitalWrite(motor_pin_2, HIGH);
digitalWrite(motor_pin_3, LOW);
digitalWrite(motor_pin_4, HIGH);
break;
case 3: //1001
digitalWrite(motor_pin_1, HIGH);
digitalWrite(motor_pin_2, LOW);
digitalWrite(motor_pin_3, LOW);
digitalWrite(motor_pin_4, HIGH);
break;
}
}
this is the sequence to make the stepper motor "step"
so I what also I'd like to know if you do a delay say every 20ms would that produce a similar control?
in the header file it references this too:
unsigned long step_delay; // delay between steps, in ms, based on speed
Thanks