I get uploading error: exit status 1 when trying to upload my code to an arduino uno. how can i fix this error. below is my code

//IOT Based Flood Monitoring And Alerting System.
#include<LiquidCrystal.h>
LiquidCrystal lcd(2,3,4,5,6,7);

const int in=8;
const int out=9;
const int green=10;
const int orange=11;
const int red=12;
const int buzz=13;

void setup(){
Serial.begin(9600);
lcd.begin(16,2);
pinMode(in, INPUT);
pinMode(out, OUTPUT);
pinMode(green, OUTPUT);
pinMode(orange, OUTPUT);
pinMode(red, OUTPUT);
pinMode(buzz, OUTPUT);
digitalWrite(green,LOW);
digitalWrite(orange,LOW);
digitalWrite(red,LOW);
digitalWrite(buzz,LOW);
lcd.setCursor(0,0);
lcd.print("Flood Monitoring");
lcd.setCursor(0,1);
lcd.print("Alerting System");
delay(5000);
lcd.clear();
}

void loop()
{
long dur;
long dist;
long per;
digitalWrite(out,LOW);
delayMicroseconds(2);
digitalWrite(out,HIGH);
delayMicroseconds(10);
digitalWrite(out,LOW);
dur=pulseIn(in,HIGH);
dist=(dur*0.034)/2;
per=map(dist,10.5,2,0,100);
//map function is used to convert the distance into percentage.
if(per<0)
{
per=0;
}
if(per>100)
{
per=100;
}
Serial.println(String(per));
lcd.setCursor(0,0);
lcd.print("Water Level:");
lcd.print(String(per));
lcd.print("% ");
if(per>=80) //MAX Level of Water--Red Alert!
{
lcd.setCursor(0,1);
lcd.print("Red Alert! ");
digitalWrite(red,HIGH);
digitalWrite(green,LOW);
digitalWrite(orange,LOW);
digitalWrite(buzz,HIGH);
delay(2000);
digitalWrite(buzz,LOW);
delay(2000);
digitalWrite(buzz,HIGH);
delay(2000);
digitalWrite(buzz,LOW);
delay(2000);

}
else if(per>=55) //Intermedite Level of Water--Orange Alert!
{
lcd.setCursor(0,1);
lcd.print("Orange Alert! ");
digitalWrite(orange,HIGH);
digitalWrite(red,LOW);
digitalWrite(green,LOW);
digitalWrite(buzz,HIGH);
delay(3000);
digitalWrite(buzz,LOW);
delay(3000);

}else //MIN/NORMAL level of Water--Green Alert!
{
lcd.setCursor(0,1);
lcd.print("Green Alert! ");
digitalWrite(green,HIGH);
digitalWrite(orange,LOW);
digitalWrite(red,LOW);
digitalWrite(buzz,LOW);
}

delay(15000);
}

Please follow the advice given in the link below when posting code, in particular the section entitled 'Posting code and common code problems'

Use code tags (the </> icon above the compose window) to make it easier to read and copy for examination

Please post the full error message copied from the IDE using the "Copy error message" button, using code tags when you post it

Have you got the correct COM port and board selected in the IDE ?

Please include the entire error message. It is easy to do. There is a button (lower right of the IDE window) called "copy error message". Copy the error and paste into a post in code tags. Paraphrasing the error message leaves out important information.

yes i have selected the correct board and port. here is the full error message:

Sketch uses 6002 bytes (18%) of program storage space. Maximum is 32256 bytes.
Global variables use 328 bytes (16%) of dynamic memory, leaving 1720 bytes for local variables. Maximum is 2048 bytes.
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0x45
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 2 of 10: not in sync: resp=0x45
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 3 of 10: not in sync: resp=0x45
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 4 of 10: not in sync: resp=0x45
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 5 of 10: not in sync: resp=0x45
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 6 of 10: not in sync: resp=0x45
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 7 of 10: not in sync: resp=0x45
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 8 of 10: not in sync: resp=0x45
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 9 of 10: not in sync: resp=0x45
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 10 of 10: not in sync: resp=0x45
Failed uploading: uploading error: exit status 1

here is the full error message:

Sketch uses 6002 bytes (18%) of program storage space. Maximum is 32256 bytes.
Global variables use 328 bytes (16%) of dynamic memory, leaving 1720 bytes for local variables. Maximum is 2048 bytes.
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0x45
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 2 of 10: not in sync: resp=0x45
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 3 of 10: not in sync: resp=0x45
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 4 of 10: not in sync: resp=0x45
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 5 of 10: not in sync: resp=0x45
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 6 of 10: not in sync: resp=0x45
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 7 of 10: not in sync: resp=0x45
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 8 of 10: not in sync: resp=0x45
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 9 of 10: not in sync: resp=0x45
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 10 of 10: not in sync: resp=0x45
Failed uploading: uploading error: exit status 1

That means that there is a failure for the PC to communicate with the Arduino.

Did you select the right board in the IDE Tools, Boards menu?

Did you select the right serial port in the IDE Tools, Port menu?

Isa there anything connected to the hardware serial pins (pins 0 and 1)? If so, disconnect and try again.

Have you tried the suggestions in the troubleshooting upload problems page?

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