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()
{
}