1

Topic: Lost connection

Hi
Can you help me to solve a problem when the connection is lost.

I need a code to reboot Arduino when the connection between HC-05(06) Bluetooth module and android is lost.

2

Re: Lost connection

Hello,
try to use the variable 'connect_flag' in RemoteXY structure.

3

Re: Lost connection

Thanks

I am a beginner and I don't understand how to use 'connect_flag'.
Can you please explain me in more detail.

4

Re: Lost connection

same issue of lost connection. Not sure how to use connect flag either.

5

Re: Lost connection

Welcome,

Something like this:

void loop()
{
  RemoteXY_Handler ();

  static bool wasConnected = false;
  if ( wasConnected == false )
  {
    if ( RemoteXY.connect_flag == 1 )
    {
      wasConnected = true;
      Serial.println( "Connected..." );
    }
  }
  else if ( RemoteXY.connect_flag == 0 )
  {
    wasConnected = false;
    Serial.println( "Connection lost, rebooting..." );
    rebootArduino();
  }
}