Switch between two codes

By "two codes" presumably you mean two sketches?

I'd try something along the lines of combining the sketches into one, which would probably mean having the contents of the 2x existing loop() functions stuck into their own functions say auto() and btooth() or whatever.

Then read a switch in loop() and invoke either of the functions as required. You would need to make sure your existing code, in the 2x new functions, doesn't block, so that the switch is read in loop() often enough to make your movement between the modes more or less seamless.