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);
}
}