   pinMode(LED_RED, OUTPUT);
   pinMode(TRIG_PIN, OUTPUT);
   pinMode(ECHO_PIN, INPUT);
+  pinMode(TERMINATE_BUTTON, INPUT);
   //pinMode(FL, INPUT);
   Serial.begin(115200);
   delay(1000);

ADK adk(&Usb, manufacturer, model, accessoryName, versionNumber, url, serialNumber);
// End ADK configuration
// Debug mode for communication
bool COM_DEBUG_MODE = false;
// Debug mode for movment
bool MOV_DEBUG_MODE = false;
uint8_t inBuffer[BUFFSIZE];

  digitalWrite(LED_GREEN, LOW);
  digitalWrite(LED_YELLOW, LOW);
  digitalWrite(LED_RED, LOW);
}

void loop() {
  if (digitalRead(TERMINATE_BUTTON)==HIGH){    
    terminateAndroidApp();
    stop(HARD);
    Serial.println("Android App Closed. Push reset button to restart all.");
    while(1);
  }
  //Go in emergency mode after two bad readings from sensor
  if (MOV_DEBUG_MODE){
    Serial.print("FL reading: ");
    Serial.println(analogRead(FL));
  }
  if (!sensorsOk() && warning){
    emergency_mode=true;    
    emergency();
