And the following code
/*........................
BTS7960 Motor Driver Test
Written By : Mohannad Rawashdeh
Code for :
*/
int RPWM=5;
int LPWM=6;
int L_EN=7;
int R_EN=8;
void setup() {
// put your setup code here, to run once:
for(int i=5;i<9;i++){
pinMode(i,OUTPUT);
}
for(int i=5;i<9;i++){
digitalWrite(i,LOW);
}
delay(1000);
Serial.begin(9600);
}
void loop() {
// put your main code here, to run repeatedly:
Serial.println("EN High");
digitalWrite(R_EN,HIGH);
digitalWrite(L_EN,HIGH);
delay(500);
for(int i=0;i<50;i++){
analogWrite(RPWM,i);
Serial.println(i);
// analogWrite(LPWM,100-i);
delay(100);
}
delay(1000);
for(int i=50;i>0;i--){
analogWrite(RPWM,i);
Serial.println(i);
delay(100);
}
In this configuration both motors will spin forward, but they don't stop, accelerate and stop like they do in the single motor configuration.
If I comment out
digitalWrite(L_EN,HIGH);
then only the right motor rotates.
Any ideas where I'm going wrong with getting the motors responding correctly to the changing RPWM values?
I looked for example code and wiring set up for 2 motor config but couldn't see anything..
Thx