ibrahim ozturk

Entrepreneur, Tech CTO, Software Developer, Electronics Engineer, Author

Bluetooth Module on Arduino

Category : Arduino, Kod, Gömülü, General

I have bought HC06 Bluetooth module and tried on Arduino Uno. Finally, I can turn it on and off LED by sending “1” and “2”.

I am posting here entire code and I will send here demo video as well.

int counter = 0;
char dataChar;
void setup()
  pinMode(8, OUTPUT);

void loop()
  while(Serial.available() > 0) // Don't read unless
    dataChar = Serial.read(); // Read a character
    if(dataChar == '1')
      Serial.write("LED ON!\n");
      digitalWrite(8, HIGH);
    else if(dataChar == '2')
      Serial.write("LED OFF!\n");
      digitalWrite(8, LOW);
    else if(dataChar == '3')
      Serial.write("You pressed 3\n");
    else if(dataChar == '4')
      Serial.write("You pressed 4\n");
    else if(dataChar == '5')
      Serial.write("You pressed 5\n");
    else if(dataChar == '6')
      Serial.write("You pressed 6\n");

Issue : avrdude: stk500_getsync(): not in sync: resp=0x00 error on Arduino?

Solution : I have wasted more than one hour on this silly issue not being able to upload a sketch to the arduino uno. Eventually, i took out the pin on RX and then it could upload without any problem.

error: Content is protected !!