Connecting 2 Bluetooth Mate Golds

Hi,

For my project, I’m trying to have an Arduino Mega receive data from a device with a RS-232 port, send this data to another Arduino Mega via Bluetooth, and dump the Serial data onto my computer.

I paired the two bluetooth modules following the directions on the datasheet, then tested sending Serial data using two computers (sending Serial data through Arduino Serial monitor). At this stage, everything worked perfectly.

I started testing the Arduinos on the device and realized that I needed to change my baud rate to 38400 to match the device data output. On my sketch, I changed the baud rate of the bluetooth and Serial to 38400. Now, I can’t seem to send or receive any data through the Bluetooth.

The two modules are still pairing, but data won’t be sent through Bluetooth. I was hoping someone could help me solve this problem. Thank you in advance,

An Arduino noob

#include <SoftwareSerial.h>

#define TX 2
#define RX 3

SoftwareSerial bluetooth(TX,RX); // Setup bluetooth pins

void setup()
{
Serial.begin(38400);

bluetooth.begin(115200); // default baud of bluetooth gold
bluetooth.print("$");
bluetooth.print("$");
bluetooth.print("$"); // enter cmd mode
delay(100);
bluetooth.println(“SM,6”); // pair mode
delay(100);
bluetooth.println(“SR,00066663232E”); // set address
delay(100);
bluetooth.println(“C,00066663232E”); // connect to address
delay(100);
bluetooth.println(“U,38400,N”); // set
delay(100);
bluetooth.begin(38400);
delay(500);
}

void loop()
{
if (Serial.available()>0)
{
bluetooth.print((char)Serial.read());
}

if (bluetooth.available()>0)
{
Serial.print((char)bluetooth.read());
}
}