Bluetooth and Prusa i3: problems with AT commands

Hi there!

I wanted to connect bluetooth to your 3d-printer Prusa i3 Hephestos (Arduino mega 2560 board). Follow these instructions: GCodeSimulator, GCodePrintr and GCodeInfo FAQ

Sketch is uploaded without problems, but does not respond to AT commands. Could you please help me? Code of instructions is shown below.
P.S. sorry for my english

#include <SoftwareSerial.h>

SoftwareSerial mySerial(65, 66); // RX, TX

void setup()
{
  // Open serial communications and wait for port to open:
  Serial.begin(9600);
  while (!Serial) {
          ; // wait for serial port to connect. Needed for Leonardo only
            }
              Serial.println("Goodnight moon!");
             // set the data rate for the SoftwareSerial port
                  mySerial.begin(9600);
                   Serial.println("Hello, world?");
                   }
  //
void loop() // run over and over
                  {
                       if (mySerial.available()){
                           Serial.write(mySerial.read());
                       }
                        if (Serial.available()){
                                 mySerial.write(Serial.read());
                        }
                  }

Oh, bluetooth module - HC06

liqsun:

#include <SoftwareSerial.h>

SoftwareSerial mySerial(65, 66); // RX, TX

I imagine your main problem might be that you are calling for pins 65,66

You might find this more effective. Just substitute your own requirements and omit unwanted commands.

/*
 This is for MEGA
 
 It seems internally HC-06 only responds to 9600 anyhow. 
 Even if you set the baud rate to 115200 you can "reprogram" 
 the sketch again with 9600.
 
 JY-MCU board pins
 RX    - 18   Tx1     orange
 TX    - 19   Rx1     white
 GND   - GND          black 
 VCC   - 5v           red
 
 Kudos to marguskohv - he sowed the seed....
 */

String command = ""; // Stores response from HC-06 

void setup() {
  // put your setup code here, to run once:
  Serial.begin(9600);       //monitor
  Serial1.begin(9600);      //bluetooth 

  Serial.println("AT");  
  Serial1.print("AT");                  //PING
  if (Serial1.available()) {
    while(Serial1.available()) { // While there is more to be read, keep reading.
      command += (char)Serial1.read();    
    }
  }

  delay(2000);   
  Serial.println(command);
  command = ""; // No repeats
  Serial.println("AT+BAUD8");  
  Serial1.print("AT+BAUD8");               //CHANGE SPEED TO 115K
  if (Serial1.available()) {
    while(Serial1.available()) { // While there is more to be read, keep reading.
      command += (char)Serial1.read();    
      delay(2000); 
      Serial.println(command);
    } 
  } 
  
  delay(2000);
  Serial.println(command);
  command = ""; // No repeats
  Serial.println("AT+NAMEFosters"); 
  Serial1.print("AT+NAMEFosters");        //CHANGE NAME
  if (Serial1.available()) {
    while(Serial1.available()) { // While there is more to be read, keep reading.
      command += (char)Serial1.read();  
    }
  }

  delay(2000);
  Serial.println(command);
  command = ""; // No repeats
  Serial.println("AT+PIN1234");
  Serial1.print("AT+PIN1234");        //CHANGE PASSWORD
  if (Serial1.available()) {
    while(Serial1.available()) { // While there is more to be read, keep reading.
      command += (char)Serial1.read();  
    }
  }

}

void loop(){
}   //one-shot - nothing here