Serial.available() always returns 0, using HC-05 BlueTooth

Hey all,

I have tried several very simple codes, in an attempt to use an HC-05 BlueTooth device.

Here is the latest code that I have been trying:

#include <SoftwareSerial.h>

SoftwareSerial BTSerial(10, 11); // RX | TX

void setup()
{
  
  pinMode(9, OUTPUT);  // this pin will pull the HC-05 pin 34 (key pin) HIGH to switch module to AT mode
  digitalWrite(9, HIGH);
  Serial.begin(9600);
  
  Serial.println("Enter AT commands:");
  BTSerial.begin(38400);  // HC-05 default speed in AT command more
}

void loop()
{
  Serial.println(BTSerial.available());
  // Keep reading from HC-05 and send to Arduino Serial Monitor
  if (BTSerial.available())
    Serial.write(BTSerial.read());

  // Keep reading from Arduino Serial Monitor and send to HC-05
  if (Serial.available())
    BTSerial.write(Serial.read());

  delay(100);
}

"Enter AT commands:"
This line is printed at the start, and then it continuously outputs 0.

I have tried using the default RX/TX inputs, I have tried not using the Key connection.

This is starting to get pretty frustrating. I can connect to the HC-05 just fine (via my android device), but the device just does not seem to want to receive data.

just for sanity, have you really connected pin 10 of your arduino to TX or the HC-05 and pin 11 of your arduino to RX of the HC-05

are you sure your arduino console is set up in a way that send (or not ) the /r/n at the end of the string you type? if not you will not send the end of line expected to interpret a command.

Not sure - but from the top of my head - don't you need to exit the command mode (i.e. put back pin to low) after you sent something to execute?