Acceleration ramps and potentiometer

Good nights, I will raise your help because I have a problem with my program. I can not check my engine through my potentiometer, when I change the value of this one my engine does not work. Is the problem just my program or maybe my connections? And also on my acceleration ramps, my increment walks normally but occasionally my "for" loop does not stop at the end as described in the program but recovery and stops in full even if applied time time everything goes well. An explanation will be welcome! And this time I would like to know if it is possible to incremeenter by twos? Thank you for your help? And good evening.

Here is my program:

const int VitesseMoteur1 = 3;
const int SensMoteur1 = 12;
const int VitesseMoteur2 = 11;
const int SensMoteur2 = 13;

const int ButtonPin = 2;
const int Button2Pin2 = 3;
const int Button3Pin3 = 4;

int potPin = 0;

int sensorValue = 0;

int outputValue = 0;

void setup() {

Serial.begin(19200);

pinMode(VitesseMoteur1, OUTPUT);
pinMode(VitesseMoteur2, OUTPUT);
pinMode(SensMoteur1, OUTPUT);
pinMode(SensMoteur2, OUTPUT);

pinMode(ButtonPin, INPUT);
pinMode(Button2Pin2, INPUT);
pinMode(Button3Pin3, INPUT);

digitalWrite(VitesseMoteur1,LOW);
digitalWrite(SensMoteur1,LOW);

digitalWrite(VitesseMoteur2,LOW);
digitalWrite(SensMoteur2,LOW);

}

void loop(){

if(digitalRead(ButtonPin) == HIGH) {
for (int x=1; x <= 255; x++) {
analogWrite(VitesseMoteur1, x);
digitalWrite(SensMoteur1,LOW);
analogWrite(VitesseMoteur2, x);
digitalWrite(SensMoteur2,HIGH);
if(analogRead(potPin)>0){
x=1;
break;
}
delay (50);
}
}

else {
analogWrite(VitesseMoteur1, LOW);
digitalWrite(SensMoteur1, LOW);
analogWrite(VitesseMoteur2, LOW);
digitalWrite(SensMoteur2, LOW);
}

if(digitalRead(Button2Pin2) == HIGH) {
for (int x=1; x <= 127; x++) {
analogWrite(VitesseMoteur1, x);
digitalWrite(SensMoteur1,LOW);
analogWrite(VitesseMoteur2, x);
digitalWrite(SensMoteur2,HIGH);
if(analogRead(potPin)>0){
x=1;
break;
}
delay (50);
}
}
else {
analogWrite(VitesseMoteur1, LOW);
digitalWrite(SensMoteur1, LOW);
analogWrite(VitesseMoteur2, LOW);
digitalWrite(SensMoteur2, LOW);
}

if(digitalRead(Button3Pin3) == HIGH) {
for (int x=1; x <= 180; x++) {
analogWrite(VitesseMoteur1, x);
digitalWrite(SensMoteur1,LOW);
analogWrite(VitesseMoteur2, x);
digitalWrite(SensMoteur2,HIGH);
if(analogRead(potPin)>0){
x=1;
break;
}
delay (50);
}
}
else {
analogWrite(VitesseMoteur1, LOW);
digitalWrite(SensMoteur1, LOW);
analogWrite(VitesseMoteur2, LOW);
digitalWrite(SensMoteur2, LOW);

}
sensorValue = analogRead(potPin);
Serial.println(sensorValue);
outputValue = map(sensorValue, 0, 1023, 0, 510);
Serial.println(outputValue);
analogWrite(VitesseMoteur1, outputValue);
digitalWrite(SensMoteur1, HIGH);
analogWrite(VitesseMoteur2, outputValue);
digitalWrite(SensMoteur2, LOW);

}

Engines are for cars . If it is electric it is a motor.

  const int VitesseMoteur1 = 3; 
const int SensMoteur1 = 12; 
const int VitesseMoteur2 = 11; 
const int SensMoteur2 = 13; 

const int ButtonPin = 2;
const int Button2Pin2 = 3;
const int Button3Pin3 = 4;

int potPin = 0;

int sensorValue = 0;

int outputValue = 0;

void setup() {
  
  Serial.begin(19200);
  
  pinMode(VitesseMoteur1, OUTPUT);
  pinMode(VitesseMoteur2, OUTPUT);
  pinMode(SensMoteur1, OUTPUT);
  pinMode(SensMoteur2, OUTPUT);
  
  pinMode(ButtonPin, INPUT);
  pinMode(Button2Pin2, INPUT);
  pinMode(Button3Pin3, INPUT);
  
  digitalWrite(VitesseMoteur1,LOW); 
  digitalWrite(SensMoteur1,LOW); 

  digitalWrite(VitesseMoteur2,LOW); 
  digitalWrite(SensMoteur2,LOW); 

}

void loop(){
  
  if(digitalRead(ButtonPin) == HIGH) {
  for (int x=1; x <= 255; x++) {
      analogWrite(VitesseMoteur1, x);
      digitalWrite(SensMoteur1,LOW);
      analogWrite(VitesseMoteur2, x);
      digitalWrite(SensMoteur2,HIGH);
      if(analogRead(potPin)>0){
        x=1;
        break;
      }
      delay (50);    
   }  
  }
   
 else {
    analogWrite(VitesseMoteur1, LOW); 
    digitalWrite(SensMoteur1, LOW);
    analogWrite(VitesseMoteur2, LOW); 
    digitalWrite(SensMoteur2, LOW);
  }
  
  if(digitalRead(Button2Pin2) == HIGH) {
  for (int x=1; x <= 127; x++) {
      analogWrite(VitesseMoteur1, x);
      digitalWrite(SensMoteur1,LOW);
      analogWrite(VitesseMoteur2, x);
      digitalWrite(SensMoteur2,HIGH);
      if(analogRead(potPin)>0){
        x=1;
        break;
      }
      delay (50);
       } 
}
else {
    analogWrite(VitesseMoteur1, LOW); 
    digitalWrite(SensMoteur1, LOW);
    analogWrite(VitesseMoteur2, LOW); 
    digitalWrite(SensMoteur2, LOW);
  }
   
  if(digitalRead(Button3Pin3) == HIGH) {
  for (int x=1; x <= 180; x++) {
      analogWrite(VitesseMoteur1, x);
      digitalWrite(SensMoteur1,LOW);
      analogWrite(VitesseMoteur2, x);
      digitalWrite(SensMoteur2,HIGH);
      if(analogRead(potPin)>0){
        x=1;
        break;
      }
      delay (50);
       }  
} 
 else {
    analogWrite(VitesseMoteur1, LOW); 
    digitalWrite(SensMoteur1, LOW);
    analogWrite(VitesseMoteur2, LOW); 
    digitalWrite(SensMoteur2, LOW);
 
 }
    sensorValue = analogRead(potPin);
    Serial.println(sensorValue);
    outputValue = map(sensorValue, 0, 1023, 0, 510);
    Serial.println(outputValue);
    analogWrite(VitesseMoteur1, outputValue); 
    digitalWrite(SensMoteur1, HIGH);
    analogWrite(VitesseMoteur2, outputValue); 
    digitalWrite(SensMoteur2, LOW);

}

USE CODE TAGS ("#" BUTTON ON TOOLBAR.

How does "USE CODE TAGS (" # "BUTTON ON TOOLBAR"

How does "USE CODE TAGS (" # "BUTTON ON TOOLBAR"

BOTTOM ROW THIRD FROM THE RIGHT , JUST TO THE LEFT OF QUOTES BUTTON.
IT CREATES A SCROLLING WINDOW LIKE THE ONE IN LAST POST SO WE CAN READ YOU CODE EASIER.