HC-05 bluetooth issue

When my HC-05 is not connected to a device, it blinks 5 times a second as it should. However when it is connected, from all the videos I see of it working properly online, It should blink two times fast every few seconds.

When I connect my HC-O5, it blinks twice at a much slower rate. This causes a specific problem.

The specific problem is that when my HC-O5 is blinking twice, any 'a' or 'd' I send via a Bluetooth terminal is delayed until the HC-05 finishes blinking twice. When the HC-05 finishes blinking, the commands I send in the Bluetooth terminal are executed instantly. However the instant the HC-05 blinks twice again, every command waits until it finishes the blinking twice before executing.

Here is the code, the Arduino is being powered by a 9v battery. It is being run through a bluetooth tereminal on an android phone.

void setup() {
Serial.begin(9600);
 pinMode(7, OUTPUT); // put your setup code here, to run once:
 }
 
void loop() {
  // put your main code here, to run repeatedly:
 if(Serial.available()>0)
   {     
      char data= Serial.read(); // reading the data received from the bluetooth module
      switch(data)
      {
        case 'a': digitalWrite(7, HIGH);break; // when a is pressed on the app on your smart phone
        case 'd': digitalWrite(7, LOW);break; // when d is pressed on the app on your smart phone
        default : break;
      }
      Serial.println(data);
   }
   delay(50);
}

Didn't we see this very same question s couple days ago?

The code is much more straightforward. I have re-worded it so hopefully its clearer

Then you should continue the other thread instead of starting a new one do that member do not waste their time suggesting the same remedies over again.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.