HELP! About Bluetooth and Analog switch!

if (key != oldkey) { // if keypress is detected
That is NOT what the code is doing.

              if (Serial.available()){
                BTSerial.write('a');
              }

Why does sending data to one device depend on data being available from another device? Why do you never read that other data?

    char bt;
    bt = BTSerial.read();
    Serial.write(BTSerial.read());

Why do you need two lines to declare and initialize a variable? Why do you read, and act on, one character, and then print something else to the serial port?