L298N chip might not be working?

Hi everyone.

I have the l298n chip (see the attachment), and I am trying to move a motor of 2A stall, but it is not working. I did this schematic (see attachment). And my code is the following one (problem is not the code bcuz i tried in a l298n driver and it worked). Can someone help me plz?

int erro = 0;
int lasterro = 0;

int brancoD = 80;
int brancoE = 80;
int pretoD = 900;
int pretoE =900;

byte potPinDir = 10;
byte aux1Dir = 7;
byte aux2Dir = 6;
byte potPinEsq = 3;
byte aux1Esq = 11;
byte aux2Esq = 2;

byte pot = 50;
byte basePot = 50;
float kp = 0.5;
float kd = 1;   
float ki = 0;
float prop = 0;
float deriv = 0;
float integ = 0;
float baseKp = 0.5;
float baseKd = 1;
float baseKi = 0;

const byte corD = A6;//parmas2
const byte corE = A2;//cenzo2
int absDir = 0;
int absEsq = 0;

bool stopSensors = 0, stopFollow = 0, stopDebug = 0;
long timeSensors = 1, timeFollow = 1, timeDebug = 500;
long lastSensors = 0, lastFollow = 0, lastDebug = 0;

int RESME;
int RESMD;

/*****************************************************************************************************************************/
void andarEsq(byte input){
  if(input > 0){
    analogWrite(potPinEsq, input);
    digitalWrite(aux1Esq, HIGH);
    digitalWrite(aux2Esq, LOW);
  }
  else{
    analogWrite(potPinEsq, -input);
    digitalWrite(aux1Esq, LOW);
    digitalWrite(aux2Esq, HIGH);
  }
}
void andarDir(byte input){
  if(input > 0){
    analogWrite(potPinDir, input);
    digitalWrite(aux1Dir, HIGH);
    digitalWrite(aux2Dir, LOW);
  }
  else{
    analogWrite(potPinDir, -input);
    digitalWrite(aux1Dir, LOW);
    digitalWrite(aux2Dir, HIGH);
  }
}

/***************************************************************************************************************************/
void taskSensors(){
  absEsq = map(analogRead(corE), brancoE, pretoE, 0, 255);
  absDir = map(analogRead(corD), brancoD, pretoD, 0, 255);
  absEsq = constrain(absEsq, 0, 255);
  absDir = constrain(absDir, 0 ,255);
  erro = absDir - absEsq;
}

void taskFollow(){
  prop = erro * kp;
  deriv = (erro - lasterro) * kd;
  integ += prop * ki;
  
  //andarEsq(pot + (prop + deriv + integ));
  //andarDir(pot - (prop + deriv + integ));
  andarDir(100);
  andarEsq(100);
  
  lasterro = erro;
}

void taskDebug(){
  Serial.print(" CorDireita: ");
  Serial.println(analogRead(corD));
  Serial.print(" CorEsquerda: ");
  Serial.println(analogRead(corE));
}
/*****************************************************************************************************************************/
void setup() {    
  pinMode(potPinDir, OUTPUT);
  pinMode(aux1Dir, OUTPUT);
  pinMode(aux2Dir, OUTPUT);
  pinMode(potPinEsq, OUTPUT);
  pinMode(aux1Esq, OUTPUT);
  pinMode(aux2Esq, OUTPUT);
  Serial.begin(9200);
}
void loop(){
  Serial.println(digitalRead(aux1Esq));
  Serial.println(digitalRead(aux2Esq));
  if (millis() - lastSensors >= timeSensors) {
    if (stopSensors == false) {
      taskSensors();
    }
    lastSensors = millis();
  }
  if (millis() - lastFollow >= timeFollow) {
    if (stopFollow == false) {
      taskFollow();
    }
    lastFollow = millis();
  }
  if (millis() - lastDebug >= timeDebug) {
    if (stopDebug == false) {
      taskDebug();
    }
    lastDebug = millis();
  }
}

chip.jpg

https://www.google.com.br/url?sa=i&rct=j&q=&esrc=s&source=images&cd=&cad=rja&uact=8&ved=0ahUKEwim6qKtirnJAhVSr5AKHXapB4gQjRwIBw&url=http%3A%2F%2Flusorobotica.com%2Findex.php%3Ftopic%3D2815.0&psig=AFQjCNHZIkAigL98oXfWUyK1winWb2yxZQ&ust=1449004808904010

this link have the correct schematic tutorial!
It worked

I suggest two things. First use the H-bridge without a microcontroller to make sure you understand the logic and to make sure your batteries will power the motor.

Second, make a very simple sketch to test the motor and h-bridge. Get rid of all the PID and sensor code for now. Just make the motor turn one direction for a few seconds, then stop for a second or two and then go backwards for a couple seconds. Once you done these simple tests you can know if the problem is your hardware or your software.

Here's my tutorial about using L298N h-bridges. It might help.

DO NOT use a small 9V battery to power your motor.

What are you using as a power supply. What motors are you using?