Bluetooth Communication using Sparkfun BluetoothMate Silver

I’m currently working on a project where I need to get my Arduino Mega2560 communicating over bluetooth (using SparkFun’s Bluetooth Mate Silver) to a Wiimote. After quite a bit of work I seem to be stuck and can’t get anywhere. I am having SEVERE problems debugging since I can’t seem to view any serial output on my monitor and the only known succesfull command I have sent to the module was to rename it (as I can see the name on my Android phone- currently my only active debugging tool). Is there anyone that actually knows how to work with these Bluetooth modules that can help (all the help online just seems to be for connecting to a PC which I do not want to do).

Thanks in advance!

Here’s my code:

#include <avr/io.h>
#include <NewSoftSerial.h> 

#define WIIADDR          001B7A3E9745
#define ANDROIDADDR      64A769C453A6


int bluetoothTx = 10;                  // TX-O pin of bluetooth mate
int bluetoothRx = 11;                  // RX-I pin of bluetooth mate

NewSoftSerial bluetooth(bluetoothTx, bluetoothRx);

void setup()
{
  Serial.begin(9600);                  // Begin the serial monitor at 9600bps
  
  bluetooth.begin(115200);             // The Bluetooth Mate defaults to 115200bps
  bluetooth.print("$$");              // Enter command mode
  delay(100);                          // Short delay, wait for the Mate to send back CMD
  bluetooth.println("U,9600,N");       // Temporarily Change the baudrate to 9600, no parity
  
  bluetooth.begin(9600);               // Start bluetooth serial at 9600
  bluetooth.print("$$");
  delay(100);
  bluetooth.println("SM,0");           // Set BTMate to slave
  delay(100);
  bluetooth.println("SN,BTMate");      // Rename Bluetooth Device
  delay(100);
  bluetooth.println("IS,5");           // Begin Inquiry Scan
  delay(100);
  bluetooth.println("C,64A769C453A6");  // Connect to Android phone
  delay(100);
  bluetooth.println("---");            // Turn off command mode
}

void loop()
{

}

Not sure that it's useful comment, but just to check your BT you can use ArduinoCommander android app https://market.android.com/details?id=name.antonsmirnov.android.arduinocommander

hi, how are u? i want to ask you about this condition…
if we use the bluetooth for communicate between android and arduino, first me must pair with arduino bluetooth and then we can control the arduino using android by bluetooth. the problem is, how to change the name of bluetooth of arduino and change the pairing code from android? as usual, if we can change the bluetooth name and pairing code of the arduino, we just change in the code of arduino, like this command : ("\r\n+STNA=BluetoothName\r\n");
but how to change bluetooth name from android not from the code of arduino? Thankyou… i need your help, please :slight_smile:
this photo wants to describe what i mean… this is the example of interface from android mobile…

ARDUINO.jpg