adafruit v2 motor shield dc motor with hall sensors help needed please

Hi
I really need some help with my latest project.
my goal is to drive a gear box x amount of times x been 1800 revolutions at this time.
I have found a encoder library that works fine my problem is when I try to control the motor nothing happens with either serial print or the motor my code is as follows

Thanks in advance

#include <Encoder.h>
#include <AFMotor.h>
AF_DCMotor motor(4);
int dp;
// Change these two numbers to the pins connected to your encoder.
// Best Performance: both pins have interrupt capability
// Good Performance: only the first pin has interrupt capability
// Low Performance: neither pin has interrupt capability
Encoder myEnc(2, 3);
// avoid using pins with LEDs attached

void setup() {
Serial.begin(9600);
Serial.println("Basic Encoder Test:");

}

long oldPosition = -999;

void loop() {
long newPosition = myEnc.read();
if (newPosition != oldPosition) {
oldPosition = newPosition;
Serial.println(newPosition);
motor.setSpeed(200);
motor.run(FORWARD);
while (newPosition<=1800);
motor.run(RELEASE);
}
}

What motor do you have? And how is the motor shield powered?

Hi
Thanks for the reply the motor is a 12v DC the shield is powered by an 12v 7.2Ah/20hr external battery. I can control the motor without the sensor and if I remove the motor from the code and spin the shaft by hand I get a count up or count down dependent on direction.