0
votes

I'm trying to use arduino with Bluetooth module (HC-06). And also im trying to send/receive data from android with the app (ArduDroid which is in playstore).

But i have the problem while sending program to Arduino uno after successful compilation. The error Code is when vcc connected to 3.3V

avrdude: stk500_getsync(): not in sync: resp=0x00

When i connected to 5V sometimes error code changes to but usually same as 3.3v

avrdude: stk500_getsync(): not in sync: resp=0x45.

When i unplug the bt device sending program is successful but i cant receive or send anything. I checked com port and board. Everything is OK. Please help me to continue my licence project. Best regards..

The code is as below:

int ledPin = 13; 
int state = 0;
int flag = 0; 

void setup() {
  pinMode(ledPin, OUTPUT);
  digitalWrite(ledPin, LOW);

  Serial.begin(9600); // Default connection rate for my BT module
}

void loop() {

  if(Serial.available() > 0){
    state = Serial.read();
    flag=0;
  }

  if (state == '0') {
    digitalWrite(ledPin, LOW);
    if(flag == 0){
      Serial.println("LED: off");
      flag = 1;
    }
  }

  else if (state == '1') {
    digitalWrite(ledPin, HIGH);
    if(flag == 0){
      Serial.println("LED: on");
      flag = 1;
    }
  }
}
2

2 Answers

0
votes

You need to unplug the module before uploading the code via USB.

the module uses the same serial pins than the ones used for USB serial, that's where your issue comes from.

uploading code via bt is tricky. it can be done but I've never succeeded myself... :(

0
votes

I've solved the problem as the same way. Just unplug the bt device and upload. After this step, plug again and connect to dc. Thats OK. working. The source of the problem is serial ports as i understand. BT module using 9600 port and disconnecting the connection between computer and arduino.