Strange problem with L293D h bridge

I tried these kinds of power supplies:

  • 4 AA NiMH batteries for arduino (multimeter showed some 5.6V) and 9V for h bridge.
  • USB for arduino and 4 AA NiMH batteries for motors.
  • everything on USB, when im really frustated (yes the motor actually runs if you connect either of in1 or in2 directly to ground)

The sketch is simple:

void setup() {
setMode(6,OUTPUT);// en1 pin
setMode(7,OUTPUT); //in 1
setMode(8,OUTPUT); // in2
digitalWrite(6, HIGH);
digitalWrite(7, HIGH);
//i guess 8 becomes LOW by defaut
}
void loop(){
}