0

i am trying to transfer data between two HC-05 modules one is master and another is slave, slave is receiving data successfully but after sometime about 12-13 seconds it starts garbage values and after 3-4 seconds it gets disconnected with other Bluetooth.

#include<SoftwareSerial.h>

#define BT_SERIAL_RX 11
#define BT_SERIAL_TX 10
SoftwareSerial BluetoothSerial(BT_SERIAL_RX,BT_SERIAL_TX);
String s;
char a[10];
 void setup()
{
  BluetoothSerial.begin(38400);
  Serial.begin(38400);
}
void loop(){
    int i=0;
   while(i<10)
    {
      BluetoothSerial.write(i);

       Serial.println(i);
       i++;
       delay(200);
    }


}

slave code:

#include<SoftwareSerial.h>

 String inString = "";

#define BT_SERIAL_RX 11
#define BT_SERIAL_TX 10
SoftwareSerial BluetoothSerial(BT_SERIAL_RX,BT_SERIAL_TX);

String message;
void setup()
{
  BluetoothSerial.begin(38400);
  Serial.begin(38400);
  }
void loop()
{

  if( BluetoothSerial.available() > 0)
  {    message=BluetoothSerial.read();
    Serial.println(message);
  }

  delay(200);
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.