Problem with dc motor speed control.

Hi, I am using the motor driver l298 to control the speed of a motor like is shown in the link above.

The motor and the motor driver seems to work well, but the problem I have is that the speed is always the same. I have conected the ENA to a digital pin and I am using 6 AA bateries.

This is the code i used.

int enA = 10; 
int in1 = 9; 
int in2 = 8;   

void setup() {
   pinMode(enA, OUTPUT);
   pinMode(in1, OUTPUT);
   pinMode(in2, OUTPUT);
}

void loop() {
  for(int i = 0; i < 250; i++)
  {
    digitalWrite(in1, HIGH); // turn on left motor to forward
    digitalWrite(in2, LOW);
    analogWrite(enA,i);
    delay(200);
  }
}

If you exchange the HIGH/LOW constants for the in1/2 pins, does it change direction?

Is the motor under load? Have you tried seeing if that makes a difference?

WattsThat:
If you exchange the HIGH/LOW constants for the in1/2 pins, does it change direction?

yeah it works fine, but the problem is that it is always with the same speed.

I'd expect it to have very little effect on an unloaded motor - have you tried it under load?

Have you solved the problem ?