     // Clear buffer for module communication
     content = "";
     // Send request for device name, using the address provided.
-    Serial.println("Sending request");
     btSerial.write("at+rname?");
-    btSerial.write((deviceAddress[i]).c_str());
+    btSerial.write((BluetoothDevices::address[i]).c_str());
     btSerial.write("\r\n");
     while(!btSerial.available()) {
       // wait for response

        character = btSerial.read();
        content.concat(character);
    }
    Serial.print(content);
    // If return matches with our expected response, that means device is in range :)
    if (content.startsWith(expectedResponse[i])) {
      output=HIGH;
    }
  }


// Array for device addresses and expected return to match name
#define NUM_DEVICES 2 // should match number of elements below
struct BluetoothDevices {
  // MAC addresses of recognized bluetooth devices. Format: 0000,00,000000
  static const String address[NUM_DEVICES];
  // Expected response of device name, starting with "+RNAME:"
  static const String name[NUM_DEVICES];
};
// Actual device names and addresses are stored in include file
#include "BluetoothDevices.h"

// Some state variables to keep track of things
int currentState = LOW;
