In addition, I've been trying to write code so that the motor just 1 step at a time as a shortcut way to do micro-stepping w/o using a library. So, I have stepCount to keep track of # of steps total, and then I have the switch case to go back and forth. The problem is that the motor isn't going back + forth, it's only going in 1 direction, as dicated by the statement before the switch case. How do I fix this issue?
if (MotorRun == 1) {
// GO back + forth
myStepper.step(-1);
Serial.print("steps:");
Serial.println(stepCount);
delay(20);
stepCount=stepCount+1;
if (stepCount==10) {
myStepper.step(-1);
delay(20);
Serial.print("steps:");
Serial.println(stepCount);
stepCount=0;
stepCount=stepCount-1;
}
if (stepCount==-10) {
myStepper.step(1);
delay(20);
myStepper.step(1);
Serial.print("steps:");
Serial.println(stepCount);
stepCount=0;
stepCount=stepCount+1;
}
I haven't heard from anyone here in the past 3 days. Does anyone have suggestions for setting the current on the Arduino Motor Shield (L298 motor driver)? Or fixing the wobbling/stalling/pausing problem of the stepper motor I have?