Exit status 1 Error code

Hello i am making a self driving car, wich has exit status 1 as error

int trigger_pin = 2;
int echo_pin = 3;
long distance, pulse_duration;

#include <Servo.h>
Servo servo_13;


void setup() {
  Serial.begin (9600);

  pinMode(trigger_pin, OUTPUT);
  pinMode(echo_pin, INPUT);

  digitalWrite(trigger_pin, LOW);

servo_13.attach(13, 500, 2500);
pinMode(11,OUTPUT);
pinMode(12,OUTPUT);
}

void loop() {
if(distance <= 50) && ( servo_13.read() == 135) {
digitalWrite(12,HIGH);
digitalWrite(11,LOW);
delay(300);
digitalWrite(12,HIGH);
digitalWrite(11,HIGH);



}

if(distance <= 50) && ( servo_13.read() == 45) {
digitalWrite(12,LOW);
digitalWrite(11,HIGH);
delay(300);
digitalWrite(12,HIGH);
digitalWrite(11,HIGH);


}






digitalWrite(12,HIGH);
digitalWrite(11,HIGH);



servo_13.write(45);
delay(600);
servo_13.write(135);
delay(600);
}

 
 
 
 
 
 
 
  digitalWrite(trigger_pin, HIGH);
  delayMicroseconds(10);
  digitalWrite(trigger_pin, LOW);

  pulse_duration = pulseIn(echo_pin, HIGH);

  distance = round(pulse_duration * 0.0171);

  //distance = round(pulse_duration/0.00675);

  Serial.print(distance);
  Serial.print("cm");
  Serial.println();

  delay(500);
}


exit status 1

Compilation error: exit status 1

thats the error messige

Please can you cut & paste the whole compilation output into a message for us to see.

Where does the loop() function end in your sketch ?

Then look at how many brackets there are and their placement in

if(distance <= 50) && ( servo_13.read() == 135)

and the same in

if(distance <= 50) && ( servo_13.read() == 45) 

You do not have a problem with the IDE. Topic moved to a more suitable location on the forum.

it has multipple errors, wich i dont know how to solve

int trigger_pin = 2;
int echo_pin = 3;
long distance, pulse_duration;

#include <Servo.h>
Servo servo_13;


void setup() {
  Serial.begin (9600);

  pinMode(trigger_pin, OUTPUT);
  pinMode(echo_pin, INPUT);

  digitalWrite(trigger_pin, LOW);

servo_13.attach(13, 500, 2500);
pinMode(11,OUTPUT);
pinMode(12,OUTPUT);
}

void loop() {
if(distance <= 50) && ( servo_13.read() == 135) {
digitalWrite(12,HIGH);
digitalWrite(11,LOW);
delay(300);
digitalWrite(12,HIGH);
digitalWrite(11,HIGH);



}

if(distance <= 50) && ( servo_13.read() == 45) {
digitalWrite(12,LOW);
digitalWrite(11,HIGH);
delay(300);
digitalWrite(12,HIGH);
digitalWrite(11,HIGH);


}

}




digitalWrite(12,HIGH);
digitalWrite(11,HIGH);



servo_13.write(45);
delay(600);
servo_13.write(135);
delay(600);
}

 
 
 
 
 
 
 
  digitalWrite(trigger_pin, HIGH);
  delayMicroseconds(10);
  digitalWrite(trigger_pin, LOW);

  pulse_duration = pulseIn(echo_pin, HIGH);

  distance = round(pulse_duration * 0.0171);

  //distance = round(pulse_duration/0.00675);

  Serial.print(distance);
  Serial.print("cm");
  Serial.println();

  delay(500);
}


thats the code

C:\Users\AlexanderKunz\AppData\Local\Arduino15\RemoteSketchbook\ArduinoCloud\8d8c85ae-a2f5-4129-8187-2c33ce68e30f\Schallrobot_v1.1\Schallrobot_v1.1.ino: In function 'void loop()':
C:\Users\AlexanderKunz\AppData\Local\Arduino15\RemoteSketchbook\ArduinoCloud\8d8c85ae-a2f5-4129-8187-2c33ce68e30f\Schallrobot_v1.1\Schallrobot_v1.1.ino:23:23: error: expected identifier before '(' token
 if(distance <= 50) && ( servo_13.read() == 135) {
                       ^
C:\Users\AlexanderKunz\AppData\Local\Arduino15\RemoteSketchbook\ArduinoCloud\8d8c85ae-a2f5-4129-8187-2c33ce68e30f\Schallrobot_v1.1\Schallrobot_v1.1.ino:34:23: error: expected identifier before '(' token
 if(distance <= 50) && ( servo_13.read() == 45) {
                       ^
C:\Users\AlexanderKunz\AppData\Local\Arduino15\RemoteSketchbook\ArduinoCloud\8d8c85ae-a2f5-4129-8187-2c33ce68e30f\Schallrobot_v1.1\Schallrobot_v1.1.ino: At global scope:
C:\Users\AlexanderKunz\AppData\Local\Arduino15\RemoteSketchbook\ArduinoCloud\8d8c85ae-a2f5-4129-8187-2c33ce68e30f\Schallrobot_v1.1\Schallrobot_v1.1.ino:49:13: error: expected constructor, destructor, or type conversion before '(' token
 digitalWrite(12,HIGH);
             ^
C:\Users\AlexanderKunz\AppData\Local\Arduino15\RemoteSketchbook\ArduinoCloud\8d8c85ae-a2f5-4129-8187-2c33ce68e30f\Schallrobot_v1.1\Schallrobot_v1.1.ino:50:13: error: expected constructor, destructor, or type conversion before '(' token
 digitalWrite(11,HIGH);
             ^
C:\Users\AlexanderKunz\AppData\Local\Arduino15\RemoteSketchbook\ArduinoCloud\8d8c85ae-a2f5-4129-8187-2c33ce68e30f\Schallrobot_v1.1\Schallrobot_v1.1.ino:54:1: error: 'servo_13' does not name a type
 servo_13.write(45);
 ^~~~~~~~
C:\Users\AlexanderKunz\AppData\Local\Arduino15\RemoteSketchbook\ArduinoCloud\8d8c85ae-a2f5-4129-8187-2c33ce68e30f\Schallrobot_v1.1\Schallrobot_v1.1.ino:55:6: error: expected constructor, destructor, or type conversion before '(' token
 delay(600);
      ^
C:\Users\AlexanderKunz\AppData\Local\Arduino15\RemoteSketchbook\ArduinoCloud\8d8c85ae-a2f5-4129-8187-2c33ce68e30f\Schallrobot_v1.1\Schallrobot_v1.1.ino:56:1: error: 'servo_13' does not name a type
 servo_13.write(135);
 ^~~~~~~~
C:\Users\AlexanderKunz\AppData\Local\Arduino15\RemoteSketchbook\ArduinoCloud\8d8c85ae-a2f5-4129-8187-2c33ce68e30f\Schallrobot_v1.1\Schallrobot_v1.1.ino:57:6: error: expected constructor, destructor, or type conversion before '(' token
 delay(600);
      ^
C:\Users\AlexanderKunz\AppData\Local\Arduino15\RemoteSketchbook\ArduinoCloud\8d8c85ae-a2f5-4129-8187-2c33ce68e30f\Schallrobot_v1.1\Schallrobot_v1.1.ino:58:1: error: expected declaration before '}' token
 }
 ^

exit status 1

Compilation error: expected identifier before '(' token

thats the error code

Billy,
Please continue in your other thread. You've already been told what the problem is, over there.

1 Like

Check the number of parentheses ...

1 Like

I have merged your cross-posts @billycamaro.

Cross-posting is against the Arduino forum rules. The reason is that duplicate posts can waste the time of the people trying to help. Someone might spend a lot of time investigating and writing a detailed answer on one topic, without knowing that someone else already did the same in the other topic.

Repeated cross-posting can result in a suspension from the forum.

In the future, please only create one topic for each distinct subject matter. This is basic forum etiquette, as explained in the "How to get the best out of this forum" guide. It contains a lot of other useful information. Please read it.

Thanks in advance for your cooperation.

Actually, looks like we're continuing here, and that one's been closed. whatever.

Have you tried the suggestions others have given you?

They match :rofl:

3x opening, 3x closing

Placement is another story :wink: As mentioned by @UKHeliBob

@billycamaro
The closing ) in if(distance <= 50) closes the condition so that one must be moved.
Try something like if(distance <= 50 && ( servo_13.read() == 135))

Note:
I haven't looked at your code.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.