hc05 AT commands not working "arduino mega 250"

#include <SoftwareSerial.h>

SoftwareSerial BTSerial(0, 1); // RX | TX

void setup()
{
  pinMode(5, OUTPUT);  // this pin will pull the HC-05 pin 34 (key pin) HIGH to switch module to AT mode
  digitalWrite(5, HIGH);
  Serial.begin(9600);
  Serial.println("Enter AT commands:");
  BTSerial.begin(38400);  // HC-05 default speed in AT command more
}

void loop()
{

  // Keep reading from HC-05 and send to Arduino Serial Monitor
  if (BTSerial.available())
    Serial.write(BTSerial.read());

  // Keep reading from Arduino Serial Monitor and send to HC-05
  if (Serial.available())
    BTSerial.write(Serial.read());

}

sketch_jan29a.ino (646 Bytes)

No point in blaming the mega, that junk code won’t work on anything.
Pins 0,1 are the hardware serial pins, and share with the serial monitor.
Using software serial on hardware serial is usually fatal.
If you had trouble uploading the programme, it was because Bluetooth was on those pins while trying to do so.
Using software serial at all on a Mega, which has four hardware serial ports, is not such a bright idea.

You might find the following background notes useful.

http://homepages.ihug.com.au/~npyner/Arduino/GUIDE_2BT.pdf
http://homepages.ihug.com.au/~npyner/Arduino/BT_2_WAY.ino