Problem with steppermotor (NEMA17 5V) and A4988

I’m having a problem with my steppermotor and A4988.
It doesn’t move at all…
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 = 13;  //connect pin 13 to step
int dir = 12;  // connect pin 12 to dir
int a = 0;     //  gen counter

void setup() 
{                
  pinMode(stp, OUTPUT);
  pinMode(dir, OUTPUT);       
}


void loop() 
{
  if (a <  200)  //sweep 200 step in dir 1
   {
    a++;
    digitalWrite(stp, HIGH);   
    delay(10);               
    digitalWrite(stp, LOW);  
    delay(10);              
   }
  else 
   {
    digitalWrite(dir, HIGH);
    a++;
    digitalWrite(stp, HIGH);  
    delay(10);               
    digitalWrite(stp, LOW);  
    delay(10);
    
    if (a>400)    //sweep 200 in dir 2
     {
      a = 0;
      digitalWrite(dir, LOW);
     }
    }
}

Here are some pics:

IMG_20141204_165121.jpg

Use the wiring diagram on the Pololu A4988 webpage. Your code looks like it should work. There is also simple code in this demo

Photos are not a good way to show wiring connections. When you want to show wiring draw a diagram (in pencil is fine) and post a photo of the drawing.

Are you powering the motor from a PP3 9 volt battery? They are completely unsuitable as they can't provide enough current.

Post a link to the datasheet for your motor?

...R

Hi,
I too have a problem with something similar, but my PCB is red and a Chinese cheapy (I've had some good stuff from China too). My motor will not run untill I touch the A4988 chip, is the PCB faulty, the chip is cool so not over heating.

Check is this your problem??

Regards

Mel.