   delay(1000);
   digitalWrite(KEY_PIN, HIGH);
   delay(1000);
-  Serial.begin(9600);
   btSerial.begin(9600);
 }
 

        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;
    }
  }

  // Happened to me one of 4-5 times on average, running without any delay functions.
  // That's why we need a delay that will switch output ON immediately, but turn OFF with a delay to compensate for false negatives
  delaySwitch(output);
  // If we have device in range, we don't want to constantly talk to it
  // Delay by 5 seconds so target device doesn't have to constantly respond
  if (output == HIGH) {
    delay(5000);
  }
}

// Switch ON immediately, while delay switching OFF
