RC car

hi :slight_smile:
i make this code to be used with my robot car :smiley: " i use DC motors"
but when i upload this code to the arduino nothing happens !
also,when i delete the calling of the function >> stop,,it works !
i've no idea where's the problem,,,can anyone help me ?
i wanna make the car go forward for one second and then stop
this the code >>

int motor1Pin1 = 3; 
int motor1Pin2 = 4; 
int enable1Pin = 6; 
int motor2Pin1 = 8; 
int motor2Pin2 = 9; 
int enable2Pin = 11; 
void forward()
{
        digitalWrite(motor1Pin1, LOW);
        digitalWrite(motor1Pin2, HIGH); 
        digitalWrite(motor2Pin1, LOW);
        digitalWrite(motor2Pin2, HIGH);
}


void stop()
{
  digitalWrite(motor1Pin1,LOW);
  digitalWrite(motor1Pin2,LOW);
  digitalWrite(motor2Pin1,LOW);
  digitalWrite(motor2Pin2,LOW);
}

void setup() 
{
    pinMode(motor1Pin1, OUTPUT);
    pinMode(motor1Pin2, OUTPUT);
    pinMode(enable1Pin, OUTPUT);
    pinMode(motor2Pin1, OUTPUT);
    pinMode(motor2Pin2, OUTPUT);
    pinMode(enable2Pin, OUTPUT);
    digitalWrite(enable1Pin, HIGH);
    digitalWrite(enable2Pin,HIGH);
 forward();
delay(1000);
stop();
        }
void loop() 
   {       
     }

This is the corrected version of your code:

int motor1Pin1 = 3; 
int motor1Pin2 = 4; 
int enable1Pin = 6; 
int motor2Pin1 = 8; 
int motor2Pin2 = 9; 
int enable2Pin = 11; 

void setup() 
{
    pinMode(motor1Pin1, OUTPUT);
    pinMode(motor1Pin2, OUTPUT);
    pinMode(enable1Pin, OUTPUT);
    pinMode(motor2Pin1, OUTPUT);
    pinMode(motor2Pin2, OUTPUT);
    pinMode(enable2Pin, OUTPUT);
    digitalWrite(enable1Pin, HIGH);
    digitalWrite(enable2Pin,HIGH);
//stop();
        }



void forward()
{
        digitalWrite(motor1Pin1, LOW);
        digitalWrite(motor1Pin2, HIGH); 
        digitalWrite(motor2Pin1, LOW);
        digitalWrite(motor2Pin2, HIGH);
}


void stop()
{
  digitalWrite(motor1Pin1,LOW);
  digitalWrite(motor1Pin2,LOW);
  digitalWrite(motor2Pin1,LOW);
  digitalWrite(motor2Pin2,LOW);
}


void loop() 
   {    
  forward();
  delay(1000);
   
     }

Maybe the explanation might have something to do with how much experience (or lack thereof) you have with arduino.
If you tell me how much experience you have I will answer your question.
Technically, you are supposed to tell us this when you post so we know how to answer your question.
Also, please use the "#" CODE TAGS toolbutton next time you post your code:

it's my first project using arduino
i've watched some tutorials and made simple codes before

Your main loop was empty.
All the code was in the setup which only executes once which means the last command executed is the stop command.
Did you write that code ?

I get it now ,, thank you
by the way, yes, i wrote it with the help of some tutorials :slight_smile: