HC-06 check if connected to device

Dear arduino users,

Is there a way that I can check if the arduino / JY-MCU is connected to my mobile tough code.

if(isConnectedToMyMobile) {
Serial.println("I'm alive");
} else {
Serial.println("I'm dead");

The project is due tomorrow, so I'm stressing the f*ck out. hopefully you wonderful people can help me.


I mean on the Arduino btw

You may be able to do this by some optical device that enables Arduino to read the LED. If you used an HC-05, the STATE pin might be used to similar effect. Perhaps you may also do this by having Arduino report a failure to receive a known signal from the other end. The latter doesn't necessarily mean the device is dead, but simply that it failed to perform a required task, which may be a moire to the point.