BluetoothMate as datapipe for UNO

Hi All,

EDIT: TL,DR version - I think the question I should be asking is.. How do I tell my Uno sketch to recognise and transmit data through the BluetoothMate serial port when a connection is made?

THE DETAILS I have successfully hooked up a BluetoothMate Gold to my Uno. connected my Arduino IDE to it via bluetooth, used serial monitor to enter command mode and explored the present settings of the BluetoothMate Gold. I wired the boards according to the diagram halfway down this page, and followed these instructions and the advanced guide to bluetooth.

However, I am not able to get the UNO sketch to run and send data via the BluetoothMate Gold to my serial monitor. I am running this sketch on the UNO:

/***********************
 Bluetooth test program
***********************/

int counter = 0;
int incomingByte;

void setup() {
  Serial.begin(115200);
}

void loop() {
  // see if there's incoming serial data:
  if (Serial.available() > 0) {
    // read the oldest byte in the serial buffer:
    incomingByte = Serial.read();
    // if it's a capital R, reset the counter
    if (incomingByte == 'R') {
      Serial.println("RESET");
      counter=0;
    }
  }
  
  Serial.println(counter);
  counter++;
  
  delay(250);
}

When I use the UNO's serial port via USB I open serial monitor and see the counter working. I can send it 'R' and the counter resets. Also, the UNO's tx LED blinks as data is sent. Fine.

When I select the BluetoothMate Gold's serial port and open the serial monitor the bluetooth connection is made but the UNO's tx LED stops blinking (so I presume the sketch stops running) and no data is piped through.

What am I missing? Why isn't my BluetoothMate Gold acting as a datapipe? Do I need to add something to the sketch loaded on the UNO?

All help is much appreciated.

Nick

I am an Arduino newbie using:

13" MacBook Pro (mid 2010), OSX 10.9.5 Mavericks. Arduino IDE 1.0.6 Arduino UNO BluetoothMate Gold