Hey there
I bought the a4988 driver a couple of weeks ago and got it running with the following motor:
https://www.pololu.com/product/1205
I connected it in minimal setup with my Arduino MEGA, my code is the following:
[code]//simple A4988 connection
//jumper reset and sleep together
//connect VDD to Arduino 3.3v or 5v
//connect GND to Arduino GND (GND near VDD)
//connect 1A and 1B to stepper coil 1
//connect 2A and 2B to stepper coil 2
//connect VMOT to power source (9v battery + term)
//connect GRD to power source (9v battery - term)
int stp = 42; //connect pin 13 to step
int dir = 32; // connect pin 12 to dir
int a = 0; // gen counter
void setup()
{
pinMode(stp, OUTPUT);
pinMode(dir, OUTPUT);
}
void loop()
{
if (a < 800) //sweep 800 step in dir 1
{
a++;
digitalWrite(stp, HIGH);
delay(3);
digitalWrite(stp, LOW);
delay(3);
}
else
{
if (a<1600) {
digitalWrite(dir, HIGH);
a++;
digitalWrite(stp, HIGH);
delay(3);
digitalWrite(stp, LOW);
delay(3);
}
if (a>1600) //sweep 800 in dir 2
{
digitalWrite(dir, LOW);
}
}
}[/code]
It is powered with 22.2V from three 7.4V Batterys.
However, after rotating the given 800 steps in one direction and backwards after that, It does stop to move but also does irritating sounds. Is that because of the minimal setup or because of the program?
Greetings and thanks in advance,
joelsa