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

Today at 02:16 pm
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)
{
Serial.println(inputs);

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); }
inputs="";
}
}

Relay1.txt (1.55 KB)

Code doesn't help. It is problem with connection to the board.

BTW: Use code tags for posting source code.

Hi,

I also had such a problem and i found on internet that if u are using digital pins 0 and 1 u have to put cables out by programming.

I tried it and have no more problems about .

Try it perhaps it will hepls u

Marc

It lacks of information but yes. It could be reason.

Budvar10:
It lacks of information but yes. It could be reason.

I have connected a 5v 4channel relay board and a HC-05 Bluetooth with the arduino .
do you need any more information , please let me know.

Marco68:
Hi,

I also had such a problem and i found on internet that if u are using digital pins 0 and 1 u have to put cables out by programming.

I tried it and have no more problems about .

Try it perhaps it will hepls u

Marc

I am very new to Arduino, however I sm uding digital pin 0 & 1 for HC-05 bluetooth connection, If i remove all the wires the program uploads just fine but when i connect the wires of both HC-05 Bluetooth module & 5v 4channel realy module, the same error pops up.

First, try to disconnect all from the board and then try to upload the sketch. The bluetooth module can be a reason.
Secondly, carefully with connecting relays to the Arduino directly. Learn something about it. Which boards and modules exactly? There is plenty of modules available on the market.