Bluetooth shield help

I have a Arduino uno with a seeduino shield running this code

#include <SoftwareSerial.h>   //Software Serial Port
#define RxD 7
#define TxD 6
 
#define DEBUG_ENABLED  1

String retSymb = "+RTINQ=";//start symble when there's any return
String slaveName = ";Bluetooth_Bee_V2";// caution that ';'must be included, and make sure the slave name is right.
int nameIndex = 0;
int addrIndex = 0;

String recvBuf;
String slaveAddr;

String connectCmd = "\r\n+CONN=";

SoftwareSerial blueToothSerial(RxD,TxD);
 
void setup() 
{ 
  Serial.begin(9600);
  pinMode(RxD, INPUT);
  pinMode(TxD, OUTPUT);
  setupBlueToothConnection();
  //wait 1s and flush the serial buffer
  delay(1000);
  Serial.flush();
  blueToothSerial.flush();
} 
 
void loop() 
{
  char recvChar;
  while(1){
    if(blueToothSerial.available()){//check if there's any data sent from the remote bluetooth shield
      recvChar = blueToothSerial.read();
      Serial.print(recvChar);
    }
    if(Serial.available()){//check if there's any data sent from the local serial terminal, you can add the other applications here
      recvChar  = Serial.read();
      blueToothSerial.print(recvChar);
    }	
 } 
} 
 
void setupBlueToothConnection()
{
  blueToothSerial.begin(38400); //Set BluetoothBee BaudRate to default baud rate 38400
  blueToothSerial.print("\r\n+STWMOD=1\r\n");//set the bluetooth work in master mode
  blueToothSerial.print("\r\n+STNA=SeeedBTMaster\r\n");//set the bluetooth name as "SeeedBTMaster"
  blueToothSerial.print("\r\n+STPIN=1234\r\n");//set pincode for master. Has to be the same as slave
  blueToothSerial.print("\r\n+STAUTO=0\r\n");// Auto-connection is forbidden here
  delay(2000); // This delay is required.
  blueToothSerial.flush();
  blueToothSerial.print("\r\n+INQ=1\r\n");//make the master inquire
  Serial.println("Master is inquiring!");
  delay(2000); // This delay is required.
    
  //find the target slave
  char recvChar;
  while(1){
    if(blueToothSerial.available()){
      recvChar = blueToothSerial.read();
      recvBuf += recvChar;
      nameIndex = recvBuf.indexOf(slaveName);//get the position of slave name
      //nameIndex -= 1;//decrease the ';' in front of the slave name, to get the position of the end of the slave address
      if ( nameIndex != -1 ){
        //Serial.print(recvBuf);
 	addrIndex = (recvBuf.indexOf(retSymb,(nameIndex - retSymb.length()- 18) ) + retSymb.length());//get the start position of slave address	 		
 	slaveAddr = recvBuf.substring(addrIndex, nameIndex);//get the string of slave address 			
 	break;
      }
    }
  }
  //form the full connection command
  connectCmd += slaveAddr;
  connectCmd += "\r\n";
  int connectOK = 0;
  Serial.print("Connecting to slave:");
  Serial.print(slaveAddr);
  Serial.println(slaveName);
  //connecting the slave till they are connected
  do{
    blueToothSerial.print(connectCmd);//send connection command
    recvBuf = "";
    while(1){
      if(blueToothSerial.available()){
        recvChar = blueToothSerial.read();
 	recvBuf += recvChar;
 	if(recvBuf.indexOf("CONNECT:OK") != -1){
          connectOK = 1;
 	  Serial.println("Connected!");
 	  blueToothSerial.print("Connected!");
 	  break;
 	}else if(recvBuf.indexOf("CONNECT:FAIL") != -1){
 	  Serial.println("Connect again!");
 	  break;
 	}
      }
    }
  }while(0 == connectOK);
}

Now, this works fine. I have a tact switch hooked up using the reference page and i used an example sketch provided so i know that it is hooked up correctly. But I’m not sure how to program this code to send a command to the second arduino when i push the button.

What I am trying to accomplish is making a bluetooth remote for my bluetooth V2 robot from RobotShop. I want it to move forward when i push a button, move backward when i press another and so on. If I can get an example of how to add this to the above code I should be able to add the others. Thank you for your help in advance. Also sorry if I screwed up the layout of this post, it has been awhile since my last post.

What are you using to send the Bluetooth data ?

What data does the “remote” send?

Does this match with what you expect to receive (send it out to Serial to your PC)

If all of the above is correct, then your code to parse is not working, else there is a transmission problem or a miss understanding of what you expect to receive from the “remote”

i.e break the problem down into smaller chunks and get one bit working at a time.

I am using Bluetooth serial to send my commands. What i did to try and simplify this is just use the master BT example from above and then plug in the programming for a single tact switch to serial.print "hello". This doesn't work however. The two BT modules will connect but the button is then ignored. I have tried moving the

buttonState = digitalRead(button);
  if (buttonState == HIGH){
    Serial.println("Hello");}

Everywhere with no luck. This is what i get in the serial monitor.

Master is inquiring! Master is inquiring! Connecting to slave:22,13,2,1,1,14;Bluetooth_Bee_V2 Connected! ÿ