Going forward and backwards interferes with the gas sensor (URGENT)

Hello there, i have a Bluetooth controlled car with a gas sensor on. When i ride it with bluetooth, it goes left and right, but when i try to move it forward or backwards, it just does nothing. Apreciate some help. Here´s the code:

int redLed = 4;
int greenLed = 3;
int buzzer = 5;
int smokeA0 = A5;
// Your threshold value
int sensorThres = 120;

char t;

void setup() {
pinMode(redLed, OUTPUT);
pinMode(greenLed, OUTPUT);
pinMode(buzzer, OUTPUT);
pinMode(smokeA0, INPUT);
Serial.begin(9600);

pinMode(10,OUTPUT); //motor esquerdo frente
pinMode(11,OUTPUT); // motor esquerdo trás
pinMode(12,OUTPUT); // motor direito frente
pinMode(13,OUTPUT); // motor direito trás

Serial.begin(9600);
}

void loop() {
int analogSensor = analogRead(smokeA0);

Serial.print("Pin A0: ");
Serial.println(analogSensor);

// Checks if it has reached the threshold value
if (analogSensor > sensorThres)
{
digitalWrite(redLed, HIGH);
digitalWrite(greenLed, LOW);
tone(buzzer, 1000, 200);

}
else
{
digitalWrite(redLed, LOW);
digitalWrite(greenLed, HIGH);
noTone(buzzer);

}
delay(100);
if(Serial.available()){
t = Serial.read();
Serial.println(t);
}

if(t == ‘1’){ //mover para a frente
digitalWrite(10,HIGH);
digitalWrite(11,LOW);
digitalWrite(12,HIGH);
digitalWrite(13,LOW);
}

else if(t == ‘2’){ //mover para trás
digitalWrite(10,LOW);
digitalWrite(11,HIGH);
digitalWrite(12,LOW);
digitalWrite(13,HIGH);
}

else if(t == ‘3’){ //virar á direita
digitalWrite(10,LOW);
digitalWrite(11,LOW);
digitalWrite(12,HIGH);
digitalWrite(13,LOW);
}

else if(t == ‘4’){ //virar á esquerda
digitalWrite(10,HIGH);
digitalWrite(11,LOW);
digitalWrite(12,LOW);
digitalWrite(13,LOW);
}

else if(t == ‘5’){ //STOP
digitalWrite(10,LOW);
digitalWrite(11,LOW);
digitalWrite(12,LOW);
digitalWrite(13,LOW);
}
delay(100);
}

How is this “URGENT”?

What do your debug prints and LEDs tell you?

Please remember to use code tags when posting code

The description of the problem in your Original Post seems to have nothing to do with your Title.

I don't like to see "URGENT". It suggests that you want to jump the queue ahead other people with questions. That's not nice.

If you edit your Original Post you can change the Title and remove the word "urgent"

...R

use case function