 
   // Attach interrupt to input pin
   attachInterrupt(INPUT_PIN, onPinChanged, CHANGE);
+  
 }
 
 



void loop() {
  while(pendingValue == true){
    // Wait for pin to stabilize
    delay(100);
    if(notify()){
      pendingValue = false;
    }
  }
  if(connected == true){
    if(millis() - lastEvent > SLEEP_TIME_MILLIS){
      go_to_sleep();
    }
  }
}


BLEServer* pServer = NULL;
BLECharacteristic* pCharacteristic = NULL;
BLEAdvertising *pAdvertising = NULL;

bool connected = false;
bool pendingValue = false;
