const int ctrl_rightA = A2;
const int ctrl_rightB = A3;
void setup() {
// put your setup code here, to run once:
pinMode(ctrl_rightA,OUTPUT);
pinMode(ctrl_rightB,OUTPUT);
}
void Run(void){
//RUN FORWARD
digitalWrite(ctrl_rightA,HIGH);
digitalWrite(ctrl_rightB,LOW);
}
void loop() {
// put your main code here, to run repeatedly:
Run();
delay(8000);
//STOP
digitalWrite(ctrl_rightA,LOW);
digitalWrite(ctrl_rightB,LOW);
delay(2000);
//riverse
digitalWrite(ctrl_rightA,LOW);
digitalWrite(ctrl_rightB,HIGH);
delay(8000);
}
The L298 is not the best choice for your motor. It is a bipolar device which will have about 1.4V drop across each side for a total of about 2.8V. That voltage drop is burnt up in the bipolar drivers as heat. They have voltage but not capacity. There internal resistance is high and gets higher as it is discharged. I would suggest you find another H-Bridge that uses MOSFET outputs, you will get probably 2.5V or more at the motor. LarryD gave you a good suggestion, it will work better. You might also investigate in a wall wart to power off the line, a lot less money over time.