Bluetooth Serial Communication

Hey! I am currently working on a project wherein I am required to connect my cell phone to the arduino (Atmega8) via bluetooth (HC-05) and transmit some commands using a serial terminal. I also need to display a connection status such as "Loading..." or "Connecting User" on a 16x2 LCD until a device connects to the arduino this is where i'm stuck. I just can't figure out how to determine whether a connection has been established between my cell phone and the arduino.

You are connected when the LED stops blinking. You might find the following background notes useful

If your HC-05 is one of the typical ones I've seen and used on a baseboard, you have 6 pins coming from it. KEY, GND, Vcc, RX, TX, STATE.

The STATE pin will change when it is connects to a remote or the remote disconnects.

What I do is attach that STATE (mislabelled on some HC-05's as SATE) pin to an interrupt pin on the Arduino. I think on the ATmega8 you have Int0 and Int1.

In my Setup:

handleConnectionLED();// sends a menu to the remote
 attachInterrupt(1, handleConnectionLED, CHANGE);// attach BT STATE pin to PIN 3, this provides a user menu on connection

Then use these routines to detect a change and either send a menu out or something else on disconnect.

void handleConnectionLED() {
 switch (digitalRead(3)) {// watch the interrupt pin (UNO)
 case LOW:// lost connection
   digitalWrite(ledPIN,LOW);// shows an external LED for connection status
 case HIGH:// got connection
   myMenu();// show the menu options
void myMenu() {
 serialBT.println(F("Welcome to Buffy BT"));

That solved the problem. Thanks a lot:-)