const int pinI1=8;     // motor 1 pin1
const int pinI2=11;    //motor 1 pin2
const int speedpinA=9; //EA(PWM)to control the motor_1 speed
const int pinI3=12;    //motor 2 pin 1
const int pinI4=13;    //motor 2 pin 2
const int speedpinB=10;//EB(PWM]) to control the motor_2 speed
void setup()
{
    pinMode(pinI1,OUTPUT); //set to output
    pinMode(pinI2,OUTPUT);
    pinMode(speedpinA,OUTPUT);
    pinMode(pinI3,OUTPUT);
    pinMode(pinI4,OUTPUT);
    pinMode(speedpinB,OUTPUT);
}
void loop()
{
    delay(1000);
    Test_Load_Left();
    delay(3000);
    clean_Output();
    delay(2000);
    Test_Load_Right();
    delay(3000);
    clean_Output();
    delay(2000);
}
/*Set the motor1 clockwise and motor2 anticlockwise, with speed 150*/
void Test_Load_Right()
{
  analogWrite(speedpinA,100);   
  analogWrite(speedpinB,50);   
  digitalWrite(pinI1,HIGH);
  digitalWrite(pinI2,LOW);
  digitalWrite(pinI3,HIGH);
  digitalWrite(pinI4,LOW);
}
/*Set the motor1 clockwise and motor2 anticlockwise, with speed 100 */
void Test_Load_Left()
{
  analogWrite(speedpinA,50);    
  analogWrite(speedpinB,100);    
  digitalWrite(pinI1,HIGH);
  digitalWrite(pinI2,LOW);
  digitalWrite(pinI3,HIGH);
  digitalWrite(pinI4,LOW);
}

/*Stop the motors */
void clean_Output()
{
  digitalWrite(speedpinA,LOW);// full PWM 255
  digitalWrite(speedpinB,LOW);
}
