 
 void monitorSensorTagButtons(BLEDevice peripheral)
 {
-  static bool getAllServices = true;
-  static int serviceIndx = 0;
-
   // connect to the peripheral
   Serial.println("Connecting ...");
   if (peripheral.connect()) {

    return;
  }

  if (getAllServices) {
    // discover peripheral attributes
    Serial.println("Discovering attributes ...");
    if (peripheral.discoverAttributes()) {
      Serial.println("Attributes discovered");
    } else {
      getAllServices = false;
      Serial.println("Attribute discovery failed.");
      peripheral.disconnect();
      return;
    }
  } else {
    int tmp = serviceIndx;
    Serial.print("Discovering Service: ");
    Serial.println(serviceUUIDArray[tmp]);
    if (++serviceIndx >= NUM_OF_SERVICE)
      serviceIndx = 0;
    if (peripheral.discoverAttributesByService(serviceUUIDArray[tmp]) == false) {
      Serial.println("Can't find the Service.");
      peripheral.disconnect();
      return;
    } else {
      Serial.println("Service discovered.");
    }
  }

  // retrieve the simple key characteristic
  BLECharacteristic simpleKeyCharacteristic = peripheral.characteristic("0000ffe1-0000-1000-8000-00805f9b34fb");

  // subscribe to the simple key characteristic
  Serial.println("Subscribing to simple key characteristic ...");

 */

#include <CurieBLE.h>

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