I bought a couple of A4983
replacement boards and hooked one up to my 1205
motor. I had this running quite well a few months ago when I last had it all set up. I can’t get it to run right. I don’t know what I have done wrong.
The motor runs smoothly but slowly and it won’t stop. I tried different sets of code and get the same results. I set the for loop to only run 10 steps. I added different delays but they are ignored. I thought that the Arduino wasn’t getting updated so I took out the code void loop except for one integer. The motor reacted by not running and locking up like I thought that it would. When I put the write code back in, it runs as before.
What can I do to fix this?
This is one of the sets of code that I used.
#define stepPin 42
#define dirPin 44
#define enablePin 46
void setup()
{
// We set the enable pin to be an output
pinMode(enablePin, OUTPUT);
// then we set it HIGH so that the board is disabled until we
// get into a known state.
digitalWrite(enablePin, HIGH);
Serial.begin(9600);
Serial.println("Starting stepper exerciser.");
pinMode(stepPin, OUTPUT);
pinMode(dirPin, OUTPUT);
}
void loop()
{
int j;
digitalWrite(enablePin, LOW);
delayMicroseconds(2);
digitalWrite(dirPin, HIGH);
for(j=0; j<=10; j++)
{
digitalWrite(stepPin, LOW);
delayMicroseconds(2);
digitalWrite(stepPin, HIGH);
delayMicroseconds(1000);
Serial.println(j);
}
digitalWrite(enablePin, HIGH);
delayMicroseconds(10000);
//delay(3000);
//while(j==10000)
Serial.println(j);
Serial.println("Loop");
}