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;
}
}
}