Avrdude: stk500_getsync() attempt 10 of 10: not in sync: resp=0xf2;a

Hello I am totaly new to Arduino, and I was trying to upload the code, I have an Arduino Uno R3 ATmega328p,
I am not really experienced at this stuff and I had this problem.

Error uploading Sketch:
avrdude: stk500_getsync() attempt 9 of 10: not in sync: resp=0xf2
avrdude stk500_recv() programmer is not responding
avrdude: stk500_getsync() attempt 9 of 10: not in sync: resp=0xf2

The code is as follow:


String inputs;
#define relay1 2 //Connect relay1 to pin 9
#define relay2 3 //Connect relay2 to pin 8
#define relay3 4 //Connect relay3 to pin 7
#define relay4 5 //Connect relay4 to pin 6

void setup() {
Serial.begin(9600); //Set rate for communicating with phone
pinMode(relay1, OUTPUT); //Set relay1 as an output
pinMode(relay2, OUTPUT); //Set relay2 as an output
pinMode(relay3, OUTPUT); //Set relay1 as an output
pinMode(relay4, OUTPUT); //Set relay2 as an output
digitalWrite(relay1, LOW); //Switch relay1 off
digitalWrite(relay2, LOW); //Swtich relay2 off
digitalWrite(relay3, LOW); //Switch relay3 off
digitalWrite(relay4, LOW); //Swtich relay4 off

void loop() {
while(Serial.available()) //Check if there are available bytes to read
delay(10); //Delay to make it stable
char c = Serial.read(); //Conduct a serial read
if (c == '#'){ break; } //Stop the loop once # is detected after a word
inputs += c; //Means inputs = inputs + c
if (inputs.length() >0)

if(inputs == "A") { digitalWrite(relay1, LOW); }

else if(inputs == "a") { digitalWrite(relay1, HIGH); }

else if(inputs == "B") { digitalWrite(relay2, LOW); }

else if(inputs == "b") { digitalWrite(relay2, HIGH); }

else if(inputs == "C") { digitalWrite(relay3, LOW); }

else if(inputs == "c") { digitalWrite(relay3, HIGH); }

else if(inputs == "D") { digitalWrite(relay4, LOW); }

else if(inputs == "d") { digitalWrite(relay4, HIGH); }

Relay1.txt (1.55 KB)

Do you have the correct COM PORT ?


If else

Try burning a new bootloader

You should check your COM Port and Board selected.

First check Tools / Port / Com & then Tools / Port / Board. The problem will resolve.

If you can't find your COM Port then you need to install Arduino drivers.