[Problem] Help in using a 6wire direction motor

Hello,
I have a NIKKO electronic car that I want to control with an Arduino I know that 3 wires are for the potentiometer and 2 for motor and 1 for the parasites.
But when i created my function to go to a specific angle I encounter problems : it just turn in one way without stopping and sometime it doesn't work at all :confused:
Here is my code

int const INFO = A0;
int const GAUCHE = 5;
int const DROIT = 6;
int const VITESSE_FONCTIONNEMENT_SERVO = 100;
int position_servo;
int old_val = -1;

int potar=0;
void setup() {
  // put your setup code here, to run once:
Serial.begin (9600); 
pinMode(GAUCHE, OUTPUT);
pinMode(DROIT, OUTPUT);
digitalWrite(DROIT,LOW);
digitalWrite(GAUCHE,LOW); // avoid short circuit
pinMode(INFO, INPUT);
}

void loop() {

setAngle(135);
delay(500);
setAngle(65);
delay(500);
}

void setAngle(int angle){
int position_servo=analogRead(INFO); // read the potentiometer's value
  int old_angle=map(position_servo,190,800,30,150);// make it correpond to an angle
  if(angle-old_angle<0){
      //must reach a position which is to the left of his actual position
  analogWrite(GAUCHE, VITESSE_FONCTIONNEMENT_SERVO);   
  digitalWrite(DROIT, LOW); 
  do {
        
    int position_servo=analogRead(INFO);
     int old_angle=map(position_servo,190,800,30,150);
     delay(1);
  }while(old_angle>angle); // powers the "left" wire until he gets to the right postion
  digitalWrite(GAUCHE,LOW);
  }
  
  
  else if (angle-old_angle>0){ // if angle i want is inferior to the one it is acutally at 
 digitalWrite(GAUCHE, LOW);  
  analogWrite(DROIT, VITESSE_FONCTIONNEMENT_SERVO);
    do {
       
    int position_servo=analogRead(INFO);
     int old_angle=map(position_servo,190,800,30,150);
     delay(1);
  }while(old_angle < angle); 
  digitalWrite(DROIT,LOW);     
}
}

I don't understand why he doesn't work (it doesn't come from the wire because i can make the motor move) English is not my mother language but i did my best to explain clearly my problem

Please help me it's for a project if you have any question I'll be glad to answer them(must I say it or them ?)
Thank you

Bad idea:

     delay(1);

Why buy a 16MHz processor and make it run at 0.1MHz?

Also a poor idea to write a blocking function but this is probably just for testing the motor for now?

If there's 2 wires for the motor then it's probably expecting an H-bridge to drive it. Do the wires go directly to the motor or is there some kind of driver board in between? For an H-bridge, you must drive one wire HIGH and one LOW to make it move.

When you get this part working, you can start on proportional control. Make the drive strength depend on the distance to the target so that it slows down when arriving at the target.

I use the delay(1) to make it stop to a precise angle

Why do you say it's a blocking function ? It's not for test, I need to control it :wink:

Don't worry I've got a H bridge L9110 to control the direction of the motor

And I don't control the speed motor I will only limit the speed by putting an object in the remote so the car is slowed.

Thank you by advance

delay(1) doesn't make it stop. It just stops the Arduino from processing anything. The motor is still moving during that millisecond.

It's a blocking function because it waits until the motor reaches the desired position. You can't process any other inputs during that time. If the desired output position changes or someone pressed the Emergency Stop, then you still drive all the way to the target before any other code can run to look at those conditions.