no error but cant run

hey guys. need help.im using this program. it has no error but when i try it it cant run my dc motor. what seems to be the problem?

#include <AFMotor.h>

AF_DCMotor motorRight(1, MOTOR12_64KHZ);
AF_DCMotor motorLeft(3, MOTOR12_64KHZ);

char dataIn = ‘S’;
char determinant;
char det;
int vel = 255;

void setup() {
Serial.begin(9600);
Serial.println("");

}

void loop() {
det = check();

switch (det){
case ‘F’:
motorRight.setSpeed(vel);
motorLeft.setSpeed(125);
motorRight.run(FORWARD);
motorLeft.run(FORWARD);
det = check();
break;

}
}

int check(){
determinant = ‘F’;

return determinant;
}

What is the power supply? Have you connected the grounds? Do you have the actual Adafruit shield or are you just using the library?

MorganS: What is the power supply? Have you connected the grounds? Do you have the actual Adafruit shield or are you just using the library?

im using 9v battery that connected to my l293d motor shield

A 9V battery won't power anything except the smallest motors. If you have a multimeter, it's interesting to see what the battery voltage is when you connect a motor directly.

. it has no error but when i try it it cant run

It is quite easy to write a program that compiles without error, but won't do anything useful at all.

The compiler will complain if your program has mistakes which make it impossible for the compiler to understand, but won' tell you if it is logically nonsense.

Your program looks to me as though it should do something, it seems incomplete, but it should do something. If it does nothing, you have some kind of power supply or wiring problem.

Probably the moment he tries to turn on the motor, the voltage on the battery droops so low that it resets the board - if he's using one of those common rectangular 9v batteries, that's what I'd expect to happen. Those are only for low current, ie, not motors - but people seem drawn to them because they look like an easy way to get 9v.